YieldTermStructureHandle via SWIG

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

YieldTermStructureHandle via SWIG

smazzucca
I am trying to populate Bond properties by setting the price engine to DiscountingBondEngine.

In order to do this I need to pass a YieldTermStructureHandle.

I can instantiate a YieldTermStructureHandle by passing a FlatForward instance, but the numbers don't match the R sample we are using.

We want to try by passing an InterpolatedZeroCurve instead of a FlatForward, but I see it's not available.

Is there a way to have SWIG expose that ?

Thank you,
Simon
Reply | Threaded
Open this post in threaded view
|

Re: YieldTermStructureHandle via SWIG

Luigi Ballabio
Hi,
    InterpolatedZeroCurve is a template and can't be exported as such.
Right now the SWIG module exports the ZeroCurve class, which is
InterpolatedZeroCurve<Linear>. If you need a different interpolations,
you can edit QuantLib-SWIG/SWIG/zerocurve.i and add it at the end in
the same way as Linear was.

Luigi



On Thu, Dec 12, 2013 at 5:12 PM, smazzucca <[hidden email]> wrote:

> I am trying to populate Bond properties by setting the price engine to
> DiscountingBondEngine.
>
> In order to do this I need to pass a YieldTermStructureHandle.
>
> I can instantiate a YieldTermStructureHandle by passing a FlatForward
> instance, but the numbers don't match the R sample we are using.
>
> We want to try by passing an InterpolatedZeroCurve instead of a FlatForward,
> but I see it's not available.
>
> Is there a way to have SWIG expose that ?
>
> Thank you,
> Simon
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/YieldTermStructureHandle-via-SWIG-tp14726.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: YieldTermStructureHandle via SWIG

smazzucca
I see, that's what I was suspecting.
I'll let you know if that will work for us.

Thank you,
Simon


-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Thursday, December 12, 2013 11:43 AM
To: Simon Mazzucca
Cc: QuantLib users
Subject: Re: [Quantlib-users] YieldTermStructureHandle via SWIG

Hi,
    InterpolatedZeroCurve is a template and can't be exported as such.
Right now the SWIG module exports the ZeroCurve class, which is InterpolatedZeroCurve<Linear>. If you need a different interpolations, you can edit QuantLib-SWIG/SWIG/zerocurve.i and add it at the end in the same way as Linear was.

Luigi



On Thu, Dec 12, 2013 at 5:12 PM, smazzucca <[hidden email]> wrote:

> I am trying to populate Bond properties by setting the price engine to
> DiscountingBondEngine.
>
> In order to do this I need to pass a YieldTermStructureHandle.
>
> I can instantiate a YieldTermStructureHandle by passing a FlatForward
> instance, but the numbers don't match the R sample we are using.
>
> We want to try by passing an InterpolatedZeroCurve instead of a
> FlatForward, but I see it's not available.
>
> Is there a way to have SWIG expose that ?
>
> Thank you,
> Simon
>
>
>
> --
> View this message in context:
> http://quantlib.10058.n7.nabble.com/YieldTermStructureHandle-via-SWIG-
> tp14726.html Sent from the quantlib-users mailing list archive at
> Nabble.com.
>
> ----------------------------------------------------------------------
> -------- Rapidly troubleshoot problems before they affect your
> business. Most IT organizations don't have a clear picture of how
> application performance affects their revenue. With AppDynamics, you
> get 100% visibility into your Java,.NET, & PHP application. Start your
> 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.c
> lktrk _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>




This e-mail, including its contents and attachments, if any, is confidential and is intended only for the addressee. If you are not the intended recipient, you are hereby notified that any use, dissemination or distribution of this communication is strictly forbidden. If you received this e-mail in error please immediately notify the sender and delete or destroy this and all copies of this message and all attachments. Any unauthorized disclosure, use, distribution, or reproduction of this message or any attachments is prohibited and may be unlawful.

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: YieldTermStructureHandle via SWIG

smazzucca
Hey Luigi,

This is how I build the YieldTermStructure:
YieldTermStructure yieldTerm = new ZeroCurve(dateVector, yields, DayCounter, _Calendar);

I was getting "negative time (-0.0246575) given" and then figured out that I have to add the evaluation date to the dateVector. So that part is good now.

(http://implementingquantlib.blogspot.com/2013/09/chapter-3-part-2-of-n-yield-term.html
"The implementation forwards to the parentZeroYieldStructure class the first of the passed dates, assumed to be the reference date for the curve, and the day counter; the other arguments are stored in the corresponding data members.")

But what should I have in the corresponding first spot of the yield vector ? I would assume that number is irrelevant and ignored, but as I change it, the results change.

Thanks,
Simon
Reply | Threaded
Open this post in threaded view
|

Re: YieldTermStructureHandle via SWIG

Luigi Ballabio
The first spot is used to interpolate between the reference date and
the first following date. Setting it equal to the first actual value
gives you flat rates over that range.

Luigi

On Fri, Dec 13, 2013 at 6:16 PM, smazzucca <[hidden email]> wrote:

> Hey Luigi,
>
> This is how I build the YieldTermStructure:
> YieldTermStructure yieldTerm = new ZeroCurve(dateVector, yields, DayCounter,
> _Calendar);
>
> I was getting "negative time (-0.0246575) given" and then figured out that I
> have to add the evaluation date to the dateVector. So that part is good now.
>
> (http://implementingquantlib.blogspot.com/2013/09/chapter-3-part-2-of-n-yield-term.html
> "The implementation forwards to the parentZeroYieldStructure class the first
> of the passed dates, assumed to be the reference date for the curve, and the
> day counter; the other arguments are stored in the corresponding data
> members.")
>
> But what should I have in the corresponding first spot of the yield vector ?
> I would assume that number is irrelevant and ignored, but as I change it,
> the results change.
>
> Thanks,
> Simon
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/YieldTermStructureHandle-via-SWIG-tp14726p14735.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: YieldTermStructureHandle via SWIG

smazzucca
Great! That works, thank you.
Simon

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Monday, December 16, 2013 10:52 AM
To: Simon Mazzucca
Cc: QuantLib users
Subject: Re: [Quantlib-users] YieldTermStructureHandle via SWIG

The first spot is used to interpolate between the reference date and the first following date. Setting it equal to the first actual value gives you flat rates over that range.

Luigi

On Fri, Dec 13, 2013 at 6:16 PM, smazzucca <[hidden email]> wrote:

> Hey Luigi,
>
> This is how I build the YieldTermStructure:
> YieldTermStructure yieldTerm = new ZeroCurve(dateVector, yields,
> DayCounter, _Calendar);
>
> I was getting "negative time (-0.0246575) given" and then figured out
> that I have to add the evaluation date to the dateVector. So that part is good now.
>
> (http://implementingquantlib.blogspot.com/2013/09/chapter-3-part-2-of-
> n-yield-term.html "The implementation forwards to the
> parentZeroYieldStructure class the first of the passed dates, assumed
> to be the reference date for the curve, and the day counter; the other
> arguments are stored in the corresponding data
> members.")
>
> But what should I have in the corresponding first spot of the yield vector ?
> I would assume that number is irrelevant and ignored, but as I change
> it, the results change.
>
> Thanks,
> Simon
>
>
>
> --
> View this message in context:
> http://quantlib.10058.n7.nabble.com/YieldTermStructureHandle-via-SWIG-
> tp14726p14735.html Sent from the quantlib-users mailing list archive
> at Nabble.com.
>
> ----------------------------------------------------------------------
> -------- Rapidly troubleshoot problems before they affect your
> business. Most IT organizations don't have a clear picture of how
> application performance affects their revenue. With AppDynamics, you
> get 100% visibility into your Java,.NET, & PHP application. Start your
> 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.c
> lktrk _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>




This e-mail, including its contents and attachments, if any, is confidential and is intended only for the addressee. If you are not the intended recipient, you are hereby notified that any use, dissemination or distribution of this communication is strictly forbidden. If you received this e-mail in error please immediately notify the sender and delete or destroy this and all copies of this message and all attachments. Any unauthorized disclosure, use, distribution, or reproduction of this message or any attachments is prohibited and may be unlawful.

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users