Yield term structure

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

Yield term structure

amandine vincotte
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
Reply | Threaded
Open this post in threaded view
|

Re: Yield term structure

marco.tarenghi

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
Reply | Threaded
Open this post in threaded view
|

Re: Yield term structure

Luigi Ballabio
On Mon, 2007-08-20 at 16:45 +0200, [hidden email]
wrote:

>
> 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));

True, but you don't need the explicit interpolation arguments. You can
avoid declaring ln and l and simply write:

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

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

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


Luigi


--

I hate quotations.
-- Ralph Waldo Emerson



-------------------------------------------------------------------------
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