constructing a yield curve using QuantLib

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

constructing a yield curve using QuantLib

Pavan Shah-2
hello, i have the following quotes from an outside source.

US00O/N Index
0.090
US0001W Index 0.122
US0002W Index 0.171


US0001M Index 0.159
US0003M Index 0.237
US0006M Index 0.330
US0012M Index 0.560
USSW2 CMPN Curncy 0.678
USSW3 CMPN Curncy 1.123
USSW4 CMPN Curncy 1.509
USSW5 CMPN Curncy 1.802
USSW6 CMPN Curncy 2.034
USSW7 CMPN Curncy 2.219
USSW8 CMPN Curncy 2.373
USSW9 CMPN Curncy 2.502
USSW10 CMPN Curncy 2.613
USSW15 CMPN Curncy 2.976
USSW20 CMPN Curncy 3.139
USSW30 CMPN Curncy 3.247

how can i input these quotes and produce a complete yield curve and corresponding vector of discount factors?

an example would be greatly appreciated

i am trying to price an option that may expire in 23 months from now (for example).
So i would need the  correct rate to use for that.

thanks

Pavan


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&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: constructing a yield curve using QuantLib

Whit Armstrong
Just take this example and use depo and swap rates.  drop the FRAs.


-Whit



On Thu, Aug 7, 2014 at 2:10 PM, Pavan Shah <[hidden email]> wrote:
hello, i have the following quotes from an outside source.

US00O/N Index
0.090
US0001W Index 0.122
US0002W Index 0.171


US0001M Index 0.159
US0003M Index 0.237
US0006M Index 0.330
US0012M Index 0.560
USSW2 CMPN Curncy 0.678
USSW3 CMPN Curncy 1.123
USSW4 CMPN Curncy 1.509
USSW5 CMPN Curncy 1.802
USSW6 CMPN Curncy 2.034
USSW7 CMPN Curncy 2.219
USSW8 CMPN Curncy 2.373
USSW9 CMPN Curncy 2.502
USSW10 CMPN Curncy 2.613
USSW15 CMPN Curncy 2.976
USSW20 CMPN Curncy 3.139
USSW30 CMPN Curncy 3.247

how can i input these quotes and produce a complete yield curve and corresponding vector of discount factors?

an example would be greatly appreciated

i am trying to price an option that may expire in 23 months from now (for example).
So i would need the  correct rate to use for that.

thanks

Pavan


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users



------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&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: constructing a yield curve using QuantLib

Pavan Shah-2
thank you so much Whit
i was able to construct a yc per the link.

however, when i call the zeroRate method i always get the first rate 0.122% that i inserted regardless of the date in the first argument. This is the first deposit rate quote Rate d1wQuote=0.00122;
the discount function also just returns 1 all the time.  i believe these two functions belong to class YieldTermStructure.

here is my  code snippet.  Assume everything is set up as in the link in your email above.

std::cout<<"the zero rate at t+8m : " << depoSwapTermStructure->zeroRate(todaysDate + 8*Months,depositDayCounter,Simple)<<std::endl;
std::cout<<"the 8month zero price to be used for discounting "<<depoSwapTermStructure->discount(todaysDate + 8*Months) <<std::endl;

depoSwapTermStructure is from 
boost::shared_ptr<YieldTermStructure>depoSwapTermStructure(new PiecewiseYieldCurve<Discount, LogLinear>(settlementDate,depoSwapInstruments,termStructureDayCounter, tolerance));


anyone , any ideas?

thanks
Pavan


On Thu, Aug 7, 2014 at 12:01 PM, Whit Armstrong <[hidden email]> wrote:
Just take this example and use depo and swap rates.  drop the FRAs.


-Whit



On Thu, Aug 7, 2014 at 2:10 PM, Pavan Shah <[hidden email]> wrote:
hello, i have the following quotes from an outside source.

US00O/N Index
0.090
US0001W Index 0.122
US0002W Index 0.171


US0001M Index 0.159
US0003M Index 0.237
US0006M Index 0.330
US0012M Index 0.560
USSW2 CMPN Curncy 0.678
USSW3 CMPN Curncy 1.123
USSW4 CMPN Curncy 1.509
USSW5 CMPN Curncy 1.802
USSW6 CMPN Curncy 2.034
USSW7 CMPN Curncy 2.219
USSW8 CMPN Curncy 2.373
USSW9 CMPN Curncy 2.502
USSW10 CMPN Curncy 2.613
USSW15 CMPN Curncy 2.976
USSW20 CMPN Curncy 3.139
USSW30 CMPN Curncy 3.247

how can i input these quotes and produce a complete yield curve and corresponding vector of discount factors?

an example would be greatly appreciated

i am trying to price an option that may expire in 23 months from now (for example).
So i would need the  correct rate to use for that.

thanks

Pavan


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users




------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: constructing a yield curve using QuantLib

Whit Armstrong
put your full code up in a gist. or a repo.


On Fri, Aug 8, 2014 at 8:29 PM, Pavan Shah <[hidden email]> wrote:
thank you so much Whit
i was able to construct a yc per the link.

however, when i call the zeroRate method i always get the first rate 0.122% that i inserted regardless of the date in the first argument. This is the first deposit rate quote Rate d1wQuote=0.00122;
the discount function also just returns 1 all the time.  i believe these two functions belong to class YieldTermStructure.

here is my  code snippet.  Assume everything is set up as in the link in your email above.

std::cout<<"the zero rate at t+8m : " << depoSwapTermStructure->zeroRate(todaysDate + 8*Months,depositDayCounter,Simple)<<std::endl;
std::cout<<"the 8month zero price to be used for discounting "<<depoSwapTermStructure->discount(todaysDate + 8*Months) <<std::endl;

depoSwapTermStructure is from 
boost::shared_ptr<YieldTermStructure>depoSwapTermStructure(new PiecewiseYieldCurve<Discount, LogLinear>(settlementDate,depoSwapInstruments,termStructureDayCounter, tolerance));


anyone , any ideas?

thanks
Pavan


On Thu, Aug 7, 2014 at 12:01 PM, Whit Armstrong <[hidden email]> wrote:
Just take this example and use depo and swap rates.  drop the FRAs.


-Whit



On Thu, Aug 7, 2014 at 2:10 PM, Pavan Shah <[hidden email]> wrote:
hello, i have the following quotes from an outside source.

US00O/N Index
0.090
US0001W Index 0.122
US0002W Index 0.171


US0001M Index 0.159
US0003M Index 0.237
US0006M Index 0.330
US0012M Index 0.560
USSW2 CMPN Curncy 0.678
USSW3 CMPN Curncy 1.123
USSW4 CMPN Curncy 1.509
USSW5 CMPN Curncy 1.802
USSW6 CMPN Curncy 2.034
USSW7 CMPN Curncy 2.219
USSW8 CMPN Curncy 2.373
USSW9 CMPN Curncy 2.502
USSW10 CMPN Curncy 2.613
USSW15 CMPN Curncy 2.976
USSW20 CMPN Curncy 3.139
USSW30 CMPN Curncy 3.247

how can i input these quotes and produce a complete yield curve and corresponding vector of discount factors?

an example would be greatly appreciated

i am trying to price an option that may expire in 23 months from now (for example).
So i would need the  correct rate to use for that.

thanks

Pavan


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users





------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: constructing a yield curve using QuantLib

Pavan Shah-2
my full code is just the link you pasted and then two lines I added above. i attached the .cpp file

but interesting observations: i do  get diff values for some dates. 
for example try 
todaysDate + 33*Months in my zeroRate function above.

you will get a rate closer to my 3Y input quote which makes sense

how does this zeroRate function work?

thanks
Pavan


On Fri, Aug 8, 2014 at 5:37 PM, Whit Armstrong <[hidden email]> wrote:
put your full code up in a gist. or a repo.


On Fri, Aug 8, 2014 at 8:29 PM, Pavan Shah <[hidden email]> wrote:
thank you so much Whit
i was able to construct a yc per the link.

however, when i call the zeroRate method i always get the first rate 0.122% that i inserted regardless of the date in the first argument. This is the first deposit rate quote Rate d1wQuote=0.00122;
the discount function also just returns 1 all the time.  i believe these two functions belong to class YieldTermStructure.

here is my  code snippet.  Assume everything is set up as in the link in your email above.

std::cout<<"the zero rate at t+8m : " << depoSwapTermStructure->zeroRate(todaysDate + 8*Months,depositDayCounter,Simple)<<std::endl;
std::cout<<"the 8month zero price to be used for discounting "<<depoSwapTermStructure->discount(todaysDate + 8*Months) <<std::endl;

depoSwapTermStructure is from 
boost::shared_ptr<YieldTermStructure>depoSwapTermStructure(new PiecewiseYieldCurve<Discount, LogLinear>(settlementDate,depoSwapInstruments,termStructureDayCounter, tolerance));


anyone , any ideas?

thanks
Pavan


On Thu, Aug 7, 2014 at 12:01 PM, Whit Armstrong <[hidden email]> wrote:
Just take this example and use depo and swap rates.  drop the FRAs.


-Whit



On Thu, Aug 7, 2014 at 2:10 PM, Pavan Shah <[hidden email]> wrote:
hello, i have the following quotes from an outside source.

US00O/N Index
0.090
US0001W Index 0.122
US0002W Index 0.171


US0001M Index 0.159
US0003M Index 0.237
US0006M Index 0.330
US0012M Index 0.560
USSW2 CMPN Curncy 0.678
USSW3 CMPN Curncy 1.123
USSW4 CMPN Curncy 1.509
USSW5 CMPN Curncy 1.802
USSW6 CMPN Curncy 2.034
USSW7 CMPN Curncy 2.219
USSW8 CMPN Curncy 2.373
USSW9 CMPN Curncy 2.502
USSW10 CMPN Curncy 2.613
USSW15 CMPN Curncy 2.976
USSW20 CMPN Curncy 3.139
USSW30 CMPN Curncy 3.247

how can i input these quotes and produce a complete yield curve and corresponding vector of discount factors?

an example would be greatly appreciated

i am trying to price an option that may expire in 23 months from now (for example).
So i would need the  correct rate to use for that.

thanks

Pavan


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users






------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

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

Re: constructing a yield curve using QuantLib

Peter Caspers-4
try feeding different quotes :)
Peter

Von meinem iPhone gesendet

Am 09.08.2014 um 02:46 schrieb Pavan Shah <[hidden email]>:

my full code is just the link you pasted and then two lines I added above. i attached the .cpp file

but interesting observations: i do  get diff values for some dates. 
for example try 
todaysDate + 33*Months in my zeroRate function above.

you will get a rate closer to my 3Y input quote which makes sense

how does this zeroRate function work?

thanks
Pavan


On Fri, Aug 8, 2014 at 5:37 PM, Whit Armstrong <[hidden email]> wrote:
put your full code up in a gist. or a repo.


On Fri, Aug 8, 2014 at 8:29 PM, Pavan Shah <[hidden email]> wrote:
thank you so much Whit
i was able to construct a yc per the link.

however, when i call the zeroRate method i always get the first rate 0.122% that i inserted regardless of the date in the first argument. This is the first deposit rate quote Rate d1wQuote=0.00122;
the discount function also just returns 1 all the time.  i believe these two functions belong to class YieldTermStructure.

here is my  code snippet.  Assume everything is set up as in the link in your email above.

std::cout<<"the zero rate at t+8m : " << depoSwapTermStructure->zeroRate(todaysDate + 8*Months,depositDayCounter,Simple)<<std::endl;
std::cout<<"the 8month zero price to be used for discounting "<<depoSwapTermStructure->discount(todaysDate + 8*Months) <<std::endl;

depoSwapTermStructure is from 
boost::shared_ptr<YieldTermStructure>depoSwapTermStructure(new PiecewiseYieldCurve<Discount, LogLinear>(settlementDate,depoSwapInstruments,termStructureDayCounter, tolerance));


anyone , any ideas?

thanks
Pavan


On Thu, Aug 7, 2014 at 12:01 PM, Whit Armstrong <[hidden email]> wrote:
Just take this example and use depo and swap rates.  drop the FRAs.


-Whit



On Thu, Aug 7, 2014 at 2:10 PM, Pavan Shah <[hidden email]> wrote:
hello, i have the following quotes from an outside source.

US00O/N Index
0.090
US0001W Index 0.122
US0002W Index 0.171


US0001M Index 0.159
US0003M Index 0.237
US0006M Index 0.330
US0012M Index 0.560
USSW2 CMPN Curncy 0.678
USSW3 CMPN Curncy 1.123
USSW4 CMPN Curncy 1.509
USSW5 CMPN Curncy 1.802
USSW6 CMPN Curncy 2.034
USSW7 CMPN Curncy 2.219
USSW8 CMPN Curncy 2.373
USSW9 CMPN Curncy 2.502
USSW10 CMPN Curncy 2.613
USSW15 CMPN Curncy 2.976
USSW20 CMPN Curncy 3.139
USSW30 CMPN Curncy 3.247

how can i input these quotes and produce a complete yield curve and corresponding vector of discount factors?

an example would be greatly appreciated

i am trying to price an option that may expire in 23 months from now (for example).
So i would need the  correct rate to use for that.

thanks

Pavan


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users





<TestYC.cpp>
------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users