Relinkable handle problem

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Relinkable handle problem

jojogh
I am now following the sample case bond to learn QuantLib. Then, I changed the Discount Yield Curve as my own one. But, i met the problem. Seems the class relinkable handle link to an empty discount curve, the result is all null much different from the sample case. What was the problem, am I following the right way to link the discount curve?
Hope someone can help me.

regards

Alex Zhang

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

main.cpp (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Relinkable handle problem

Luigi Ballabio
Hello,
    there are a few issues in your code:

1) the particular one you're having about an empty handle is because
you didn't set any curve to the liborTermStructure handle;
2) the null values are because you didn't set the evaluation date.
You define a today, but you're missing the

Settings::instance().evaluationDate() = today;

that will cause the calculations to be done at that date.
3) your discount curve spans three years, but the bond matures beyond
that date. You can either add more points, or extrapolate by adding
the instruction

disTS->enableExtrapolation();

before starting the calculations;
4) you'll need another Libor fixing for July 17 2009.

With the above changes, your program runs correctly.

Hope this helps,
    Luigi


On Tue, May 21, 2013 at 7:31 AM, Yuanhao Zhang <[hidden email]> wrote:

> I am now following the sample case bond to learn QuantLib. Then, I changed
> the Discount Yield Curve as my own one. But, i met the problem. Seems the
> class relinkable handle link to an empty discount curve, the result is all
> null much different from the sample case. What was the problem, am I
> following the right way to link the discount curve?
> Hope someone can help me.
>
> regards
>
> Alex Zhang
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Relinkable handle problem

jojogh
Hi Luigi,
I am trying to fix the the issues by following your instructions, and fixed 2,3,4 issue. But, I tried to fix liborTermStructure handle, and set it relink to disTS, but the result of floating bond is still null. I am trying to fix it all the time, but i still do not know how to fix it. Where is my problem? How to solve it.

regards

Alex Zhang


2013/5/21 Luigi Ballabio <[hidden email]>
Hello,
    there are a few issues in your code:

1) the particular one you're having about an empty handle is because
you didn't set any curve to the liborTermStructure handle;
2) the null values are because you didn't set the evaluation date.
You define a today, but you're missing the

Settings::instance().evaluationDate() = today;

that will cause the calculations to be done at that date.
3) your discount curve spans three years, but the bond matures beyond
that date. You can either add more points, or extrapolate by adding
the instruction

disTS->enableExtrapolation();

before starting the calculations;
4) you'll need another Libor fixing for July 17 2009.

With the above changes, your program runs correctly.

Hope this helps,
    Luigi


On Tue, May 21, 2013 at 7:31 AM, Yuanhao Zhang <[hidden email]> wrote:
> I am now following the sample case bond to learn QuantLib. Then, I changed
> the Discount Yield Curve as my own one. But, i met the problem. Seems the
> class relinkable handle link to an empty discount curve, the result is all
> null much different from the sample case. What was the problem, am I
> following the right way to link the discount curve?
> Hope someone can help me.
>
> regards
>
> Alex Zhang
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>


------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

main.cpp (16K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Relinkable handle problem

Luigi Ballabio
You didn't fix 2).
Just re-enable the line

Settings::instance().evaluationDate() = today;

that you commented out. With that change, the attached main.cpp works.

Luigi


On Wed, May 29, 2013 at 5:26 AM, Yuanhao Zhang <[hidden email]> wrote:

> Hi Luigi,
> I am trying to fix the the issues by following your instructions, and fixed
> 2,3,4 issue. But, I tried to fix liborTermStructure handle, and set it
> relink to disTS, but the result of floating bond is still null. I am trying
> to fix it all the time, but i still do not know how to fix it. Where is my
> problem? How to solve it.
>
> regards
>
> Alex Zhang
>
>
> 2013/5/21 Luigi Ballabio <[hidden email]>
>>
>> Hello,
>>     there are a few issues in your code:
>>
>> 1) the particular one you're having about an empty handle is because
>> you didn't set any curve to the liborTermStructure handle;
>> 2) the null values are because you didn't set the evaluation date.
>> You define a today, but you're missing the
>>
>> Settings::instance().evaluationDate() = today;
>>
>> that will cause the calculations to be done at that date.
>> 3) your discount curve spans three years, but the bond matures beyond
>> that date. You can either add more points, or extrapolate by adding
>> the instruction
>>
>> disTS->enableExtrapolation();
>>
>> before starting the calculations;
>> 4) you'll need another Libor fixing for July 17 2009.
>>
>> With the above changes, your program runs correctly.
>>
>> Hope this helps,
>>     Luigi
>>
>>
>> On Tue, May 21, 2013 at 7:31 AM, Yuanhao Zhang <[hidden email]>
>> wrote:
>> > I am now following the sample case bond to learn QuantLib. Then, I
>> > changed
>> > the Discount Yield Curve as my own one. But, i met the problem. Seems
>> > the
>> > class relinkable handle link to an empty discount curve, the result is
>> > all
>> > null much different from the sample case. What was the problem, am I
>> > following the right way to link the discount curve?
>> > Hope someone can help me.
>> >
>> > regards
>> >
>> > Alex Zhang
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Try New Relic Now & We'll Send You this Cool Shirt
>> > New Relic is the only SaaS-based application performance monitoring
>> > service
>> > that delivers powerful full stack analytics. Optimize and monitor your
>> > browser, app, & servers with just a few lines of code. Try New Relic
>> > and get this awesome Nerd Life shirt!
>> > http://p.sf.net/sfu/newrelic_d2d_may
>> > _______________________________________________
>> > QuantLib-users mailing list
>> > [hidden email]
>> > https://lists.sourceforge.net/lists/listinfo/quantlib-users
>> >
>
>

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

main.cpp (16K) Download Attachment