Login  Register

Re: Yield term structure

Posted by marco.tarenghi on Aug 20, 2007; 3:45pm
URL: http://quantlib.414.s1.nabble.com/Yield-term-structure-tp1265p1266.html


Hi, you could try something like this:
suppose you define (according to your data):
       
        Calendar cal = ...;
        DayCounter dc = ...;
        vector<Date> dates = ...;
        vector<DiscountFactor> dfs = ...;

remember that the first date must have unit discount factor.
Define also
       
        LogLinear ln;
        Linear l;

Now suppose for example you want a term structure interpolating linearly on rate * time (equivalently loglinearly on discounts)
You have:
       
        shared_ptr<YieldTermStructure> curve(new InterpolatedDiscountCurve<LogLinear>(dates, dfs, dc, cal, ln));

Or, for linear interpolation on discount factors

        shared_ptr<YieldTermStructure> curve(new InterpolatedDiscountCurve<Linear>(dates, dfs, dc, cal, l));

Also, for linear interpolation on zero rates:

        shared_ptr<YieldTermStructure> curve(new InterpolatedZeroCurve<Linear>(dates, dfs, dc, l));

Hope this helps.
Bye,
Marco



amandine vincotte <[hidden email]>
Sent by: [hidden email]

20/08/2007 16.30

To
[hidden email]
cc
Subject
[Quantlib-users] Yield term structure





Hello,
 
I am new to quantlib.
I have a series of discount factors for different dates for which I would like to find the yield term structure.
Could you please help me.
Thanks a lot
Amandine
 


Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. -------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users