Hi All,
I am new to QuantLib.
How does QuantLib interpolate discount factor from Swap Rates for those rates 1.5 yr, 2.5 yr, 2.75yr etc?
I am looking for this:
From swap rates of 1 yr, 2 yr which are known from market, fixed leg=floating leg.
interpolate discount factor of 1.5yr by log linear
Thanks a lot!
|
You need to build a yield curve. You can find how to do that in the QuantLib documentation, for example here: http://quantlib.org/slides/dima-ql-intro-2.pdf Gerardo Da: emmajyu [mailto:[hidden email]]
Hi All, I am new to QuantLib. How does QuantLib interpolate discount factor from Swap Rates for those rates 1.5 yr, 2.5 yr, 2.75yr etc? I am looking for this: >From swap rates of 1 yr, 2 yr which are known from market, fixed leg=floating
leg. interpolate discount factor of 1.5yr by log linear Thanks a lot! View this message in context:
Interpolate discount factor by swap rates
------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
thanks, Gerardo.
I read the 2-pdf. It seems QuantLib calculates the discount factor by Log Linear or Linear. But I need more help. I want to get DF (e.g. 1.5 Yr) from swap rate. For example, rate of 1 year, 2 year are known, but need to calculate 1.5 yr from the swap rate. As in swaps, Fixed Leg = Floating Leg ==> Fix leg, DF(0.5) * Delta_t(0.5) + DF(1) * Delta_t(1) + DF(1.5) * Delta_t(1.5) + DF(2) * Delta_t(2) Floating leg, = 1 - DF(2) Here we have 2 unknown var, DF(1.5 Yr) and DF(2 Yr) To solve this, use Log Linear to interpolate the DF(1.5) DF(1.5) = DF(2)^((t1.5-t1)/(t2-t1)) * DF(1)^((t2-t1.5)/(t2-t1)) Thanks a lot |
you can specify the interpolation and bootstrap policy via template arguments like in
PiecewiseYieldCurve<T,I,B>(...) T = what to interpolate = Discount, ZeroYield, ForwardRate I = how to interpolate = Linear, LogLinear, BackwardFlat, Cubic, ... many more ... B = how to bootstrap = IterativeBootstrap, LocalBootstrap so basically you might want to put your instruments into the PiecewiseYieldCurve and then retrieve discount factors (for whatever maturity) using the discount method on your yield curve object. regards Peter emmajyu <[hidden email]> writes: > thanks, Gerardo. > I read the 2-pdf. It seems QuantLib calculates the discount factor by Log > Linear or Linear. > > But I need more help. > I want to get DF (e.g. 1.5 Yr) from swap rate. > For example, rate of 1 year, 2 year are known, but need to calculate 1.5 yr > from the swap rate. > As in swaps, > Fixed Leg = Floating Leg > ==> Fix leg, DF(0.5) * Delta_t(0.5) + DF(1) * Delta_t(1) + DF(1.5) * > Delta_t(1.5) + DF(2) * Delta_t(2) > Floating leg, = 1 - DF(2) > Here we have 2 unknown var, DF(1.5 Yr) and DF(2 Yr) > To solve this, use Log Linear to interpolate the DF(1.5) > DF(1.5) = DF(2)^((t1.5-t1)/(t2-t1)) * DF(1)^((t2-t1.5)/(t2-t1)) > > > Thanks a lot > > > > -- > View this message in context: http://quantlib.10058.n7.nabble.com/Interpolate-discount-factor-by-swap-rates-tp14249p14251.html > Sent from the quantlib-users mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and > their applications. This 200-page book is written by three acclaimed > leaders in the field. The early access version is available now. > Download your free book today! http://p.sf.net/sfu/neotech_d2d_may > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Peter is correct. You can look at Examples/Swap/swapvaluation.cpp for
an example. Once you've built the curve based on the given swaps, just ask it for discounts with discountingTermStructure->discount(d); where d is the desired date. Luigi On Sun, May 12, 2013 at 8:07 PM, Peter Caspers <[hidden email]> wrote: > you can specify the interpolation and bootstrap policy via template arguments like in > > PiecewiseYieldCurve<T,I,B>(...) > > T = what to interpolate = Discount, ZeroYield, ForwardRate > I = how to interpolate = Linear, LogLinear, BackwardFlat, Cubic, ... many more ... > B = how to bootstrap = IterativeBootstrap, LocalBootstrap > > so basically you might want to put your instruments into the PiecewiseYieldCurve and then > retrieve discount factors (for whatever maturity) using the discount method on your yield curve object. > > regards > Peter > > emmajyu <[hidden email]> writes: > >> thanks, Gerardo. >> I read the 2-pdf. It seems QuantLib calculates the discount factor by Log >> Linear or Linear. >> >> But I need more help. >> I want to get DF (e.g. 1.5 Yr) from swap rate. >> For example, rate of 1 year, 2 year are known, but need to calculate 1.5 yr >> from the swap rate. >> As in swaps, >> Fixed Leg = Floating Leg >> ==> Fix leg, DF(0.5) * Delta_t(0.5) + DF(1) * Delta_t(1) + DF(1.5) * >> Delta_t(1.5) + DF(2) * Delta_t(2) >> Floating leg, = 1 - DF(2) >> Here we have 2 unknown var, DF(1.5 Yr) and DF(2 Yr) >> To solve this, use Log Linear to interpolate the DF(1.5) >> DF(1.5) = DF(2)^((t1.5-t1)/(t2-t1)) * DF(1)^((t2-t1.5)/(t2-t1)) >> >> >> Thanks a lot >> >> >> >> -- >> View this message in context: http://quantlib.10058.n7.nabble.com/Interpolate-discount-factor-by-swap-rates-tp14249p14251.html >> Sent from the quantlib-users mailing list archive at Nabble.com. >> >> ------------------------------------------------------------------------------ >> Learn Graph Databases - Download FREE O'Reilly Book >> "Graph Databases" is the definitive new guide to graph databases and >> their applications. This 200-page book is written by three acclaimed >> leaders in the field. The early access version is available now. >> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may >> _______________________________________________ >> QuantLib-users mailing list >> [hidden email] >> https://lists.sourceforge.net/lists/listinfo/quantlib-users > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and > their applications. This 200-page book is written by three acclaimed > leaders in the field. The early access version is available now. > Download your free book today! http://p.sf.net/sfu/neotech_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 |
Free forum by Nabble | Edit this page |