Hello,
I am a brand new quantlib developer, using the python bindings via SWIG. I am trying to take a YieldTermStructure (actually, a PieceswiseFlatForward) and roll it forward or update the dates - eg, given a PiecewiseFlatForward constructed with a certain reference date, I'd like to construct a new PiecewiseFlatForward with the same rates starting on a different date. Is it possible to modify the dates associated with these objects? Thanks to all, --Matt |
Hi Matt,
apologies for the late answer. You have a couple of possibilities. One is to extract the rates from the bootstrapped curve via the nodes() method (which returns a list of (date,rate) pairs) and use them to build an interpolated forward curve. In Python, that would be a ForwardCurve instance; its constructor takes a vector of dates and a vector of corresponding rates. Depending on what you want to do, another possibility is to leave the reference date of the curve free to move. For that, you can use the PiecewiseFlatForward constructor that takes settlementDays and calendar instead of a reference date; for instance, PiecewiseFlatForward(0,TARGET(),helpers,day_counter) will give you a curve whose reference date follows the evaluation date. When you bootstrap it with Settings.instance().evaluationDate set to today's date, you'll get your original curve. If you set Settings.instance().evaluationDate to a different date, the curve will perform the bootstrap again based on the new evaluation date (note, though, that this will build you a curve that gives you the same deposit and swap rates, but possibly not the very same forward rates). Hope this helps, Luigi On Mon, Oct 22, 2012 at 10:24 PM, mattgline <[hidden email]> wrote: > > Hello, > > I am a brand new quantlib developer, using the python bindings via SWIG. > > I am trying to take a YieldTermStructure (actually, a PieceswiseFlatForward) > and roll it forward or update the dates - eg, given a PiecewiseFlatForward > constructed with a certain reference date, I'd like to construct a new > PiecewiseFlatForward with the same rates starting on a different date. > > Is it possible to modify the dates associated with these objects? > > Thanks to all, > > --Matt > -- > View this message in context: http://old.nabble.com/Adjust-dates-of-term-structure--tp34588749p34588749.html > Sent from the quantlib-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users ------------------------------------------------------------------------------ LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Thanks Luigi - this is extremely helpful, exactly what I was looking to do. Unfortunately as with most good answers this has caused us to ask some more questions.
1) What are the rates produced by the nodes() function? They appear to be forwards but we're not sure of what tenor... I assume it has something to do with how the original curve was constructed? 2) Is the only difference between PiecewiseYieldCurve and ForwardCurve that the former can be bootstrapped from a combination of different kinds of rates via helpers while the latter can only be bootstrapped from forward rates? Or is there something more going on that separates them? Thanks so much! Have you ever thought about teaching a class in New York? --Matt On Tue, Nov 6, 2012 at 10:08 AM, Luigi Ballabio <[hidden email]> wrote: Hi Matt, ------------------------------------------------------------------------------ LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Matt,
in this case, the rates returned by nodes() are instantaneous forward rates. The interpolation is backward-flat (that is, the forward at a node is extended flatly back to the previous node). It corresponds to log-linear interpolation of discount factors. The ForwardCurve works in the same way, but is built from precomputed forward rates (I don't think we can even say "bootstrapped" here, since there's no solving proces involved, just interpolation). As you say, the PiecewiseYieldCurve is bootstrapped from market rates. Finally, New York would be nice, but I'd need someone on site to organize the thing... Regards, Luigi On Tue, Nov 6, 2012 at 4:46 PM, Matthew Gline <[hidden email]> wrote: > Thanks Luigi - this is extremely helpful, exactly what I was looking to do. > Unfortunately as with most good answers this has caused us to ask some more > questions. > > 1) What are the rates produced by the nodes() function? They appear to be > forwards but we're not sure of what tenor... I assume it has something to do > with how the original curve was constructed? > > 2) Is the only difference between PiecewiseYieldCurve and ForwardCurve that > the former can be bootstrapped from a combination of different kinds of > rates via helpers while the latter can only be bootstrapped from forward > rates? Or is there something more going on that separates them? > > Thanks so much! Have you ever thought about teaching a class in New York? > > --Matt > > > > On Tue, Nov 6, 2012 at 10:08 AM, Luigi Ballabio <[hidden email]> > wrote: >> >> Hi Matt, >> apologies for the late answer. >> You have a couple of possibilities. One is to extract the rates from >> the bootstrapped curve via the nodes() method (which returns a list of >> (date,rate) pairs) and use them to build an interpolated forward >> curve. In Python, that would be a ForwardCurve instance; its >> constructor takes a vector of dates and a vector of corresponding >> rates. >> >> Depending on what you want to do, another possibility is to leave the >> reference date of the curve free to move. For that, you can use the >> PiecewiseFlatForward constructor that takes settlementDays and >> calendar instead of a reference date; for instance, >> PiecewiseFlatForward(0,TARGET(),helpers,day_counter) will give you a >> curve whose reference date follows the evaluation date. When you >> bootstrap it with Settings.instance().evaluationDate set to today's >> date, you'll get your original curve. If you set >> Settings.instance().evaluationDate to a different date, the curve will >> perform the bootstrap again based on the new evaluation date (note, >> though, that this will build you a curve that gives you the same >> deposit and swap rates, but possibly not the very same forward rates). >> >> Hope this helps, >> Luigi >> >> On Mon, Oct 22, 2012 at 10:24 PM, mattgline <[hidden email]> wrote: >> > >> > Hello, >> > >> > I am a brand new quantlib developer, using the python bindings via SWIG. >> > >> > I am trying to take a YieldTermStructure (actually, a >> > PieceswiseFlatForward) >> > and roll it forward or update the dates - eg, given a >> > PiecewiseFlatForward >> > constructed with a certain reference date, I'd like to construct a new >> > PiecewiseFlatForward with the same rates starting on a different date. >> > >> > Is it possible to modify the dates associated with these objects? >> > >> > Thanks to all, >> > >> > --Matt >> > -- >> > View this message in context: >> > http://old.nabble.com/Adjust-dates-of-term-structure--tp34588749p34588749.html >> > Sent from the quantlib-users mailing list archive at Nabble.com. >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > Everyone hates slow websites. So do we. >> > Make your web apps faster with AppDynamics >> > Download AppDynamics Lite for free today: >> > http://p.sf.net/sfu/appdyn_sfd2d_oct >> > _______________________________________________ >> > QuantLib-users mailing list >> > [hidden email] >> > https://lists.sourceforge.net/lists/listinfo/quantlib-users > > ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |