piecewise flat forward algorithm

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

piecewise flat forward algorithm

Adjriou Belak
Hi ,
 
In the algorithm fo find the zero coupon (with the brent solver 1D) , there is a problem when the curve is downward !! There is an option QL_NEGATIVE_RATES that  prevents the negative rates but it prevents also the downward curve.  In the code :
 
             #if defined(QL_NEGATIVE_RATES)
            // discount are not required to be decreasing--all bets are off.
            // We choose as max a value very unlikely to be exceeded.
            DiscountFactor max = 3.0;
            #else
            DiscountFactor max = discounts_[i-1];
            #endif
            solver.solve(FFObjFunction(this,instrument,i),
                         accuracy_,guess,min,max);
 
The discount factor is set to the last one  so the curve can't be downward. So a downaward curve doesn't mean negative rates !
 
regards,
Adjriou Abdelak



Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez le ici !
Reply | Threaded
Open this post in threaded view
|

Re: piecewise flat forward algorithm

Luigi Ballabio
On 06/28/2005 10:07:10 AM, Adjriou Belak wrote:

>
> In the algorithm fo find the zero coupon (with the brent solver 1D) ,
> there is a problem when the curve is downward !! There is an option
> QL_NEGATIVE_RATES that  prevents the negative rates but it prevents
> also the downward curve.  In the code :
>
>              #if defined(QL_NEGATIVE_RATES)
>             // discount are not required to be decreasing--all bets
> are off.
>             // We choose as max a value very unlikely to be exceeded.
>             DiscountFactor max = 3.0;
>             #else
>             DiscountFactor max = discounts_[i-1];
>             #endif
>             solver.solve(FFObjFunction(this,instrument,i),
>                          accuracy_,guess,min,max);
>
> The discount factor is set to the last one  so the curve can't be
> downward. So a downaward curve doesn't mean negative rates !

I beg to differ. A downward curve might mot mean negative spot rates,  
but it does mean negative forward rates.

Later,
        Luigi

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

Brady's First Law of Problem Solving:
        When confronted by a difficult problem, you can solve it more
        easily by reducing it to the question, "How would the  
Lone Ranger have handled this?"



Reply | Threaded
Open this post in threaded view
|

RE: Re: piecewise flat forward algorithm

David Palmer-2
In reply to this post by Adjriou Belak
In the real world, negative rates occur when the spot rate is below the
inflation rate. This happens enough that it cannot be ignored. The
forward rates truly contain all market assumptions regarding the
inflation rate and the predicted response to reinvestment! Sorry for
this programmatically useless information.

Since I cannot get MSVC to compile QL due to it telling me it cannot
find the calendar libraries, I can be of no more help.

Dave

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Luigi
Ballabio
Sent: Monday, July 04, 2005 8:36 AM
To: Adjriou Belak
Cc: [hidden email]
Subject: [Quantlib-users] Re: piecewise flat forward algorithm


On 06/28/2005 10:07:10 AM, Adjriou Belak wrote:

>
> In the algorithm fo find the zero coupon (with the brent solver 1D) ,
> there is a problem when the curve is downward !! There is an option
> QL_NEGATIVE_RATES that  prevents the negative rates but it prevents
> also the downward curve.  In the code :
>
>              #if defined(QL_NEGATIVE_RATES)
>             // discount are not required to be decreasing--all bets
> are off.
>             // We choose as max a value very unlikely to be exceeded.
>             DiscountFactor max = 3.0;
>             #else
>             DiscountFactor max = discounts_[i-1];
>             #endif
>             solver.solve(FFObjFunction(this,instrument,i),
>                          accuracy_,guess,min,max);
>
> The discount factor is set to the last one  so the curve can't be
> downward. So a downaward curve doesn't mean negative rates !

I beg to differ. A downward curve might mot mean negative spot rates,  
but it does mean negative forward rates.

Later,
        Luigi

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

Brady's First Law of Problem Solving:
        When confronted by a difficult problem, you can solve it more
        easily by reducing it to the question, "How would the  
Lone Ranger have handled this?"



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
_______________________________________________
Quantlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

The information contained in and accompanying this communication is for your information only. Such information is strictly confidential and is intended solely for the use of the intended recipient (s) - recipient. If you are not the intended recipient (s) of this communication, please delete and destroy all copies immediately. This is not an offer or solicitation with respect to the purchase or sale of any security. The information is based upon information that TANSTAAFL Research & Trading, L.L.C believes to be reliable. TANSTAAFL Research & Trading, L.L.C does not accept responsibility to update any opinions or other information contained in this communication.



Reply | Threaded
Open this post in threaded view
|

RE: Re: piecewise flat forward algorithm

Adjriou Belak
In reply to this post by Luigi Ballabio
Hi,
 
I agree with you but this option makes the downward curve impossible. You can test it by making a 2Y swap rate at 6% and and a 3Y swap rate at 4 % to test, you will have an exception. In this configuration, you will not have spot and forward (2-3) rates negatives but just less big than the others. And of course there is sometimes negative rates but if this option (QL_NEGATIVE_RATES) means no negative rates, it should let downward curve.
 
Regards,
Adjriou 

Luigi Ballabio <[hidden email]> a écrit :

On 06/28/2005 10:07:10 AM, Adjriou Belak wrote:

>
> In the algorithm fo find the zero coupon (with the brent solver 1D) ,
> there is a problem when the curve is downward !! There is an option
> QL_NEGATIVE_RATES that prevents the negative rates but it prevents
> also the downward curve. In the code :
>
> #if defined(QL_NEGATIVE_RATES)
> // discount are not required to be decreasing--all bets
> are off.
> // We choose as max a value very unlikely to be exceeded.
> DiscountFactor max = 3.0;
> #else
> DiscountFactor max = discounts_[i-1];
> #endif
> solver.solve(FFObjFunction(this,instrument,i),
> accuracy_,guess,min,max);
>
> The discount factor is set to the last one so the curve can't be
> downward. So a downaward curve doesn't mean negative rates !

I beg to differ. A downward curve might mot mean negative spot rates,
but it does mean negative forward rates.

Later,
Luigi

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

Brady's First Law of Problem Solving:
When confronted by a difficult problem, you can solve it more
easily by reducing it to the question, "How would the
Lone Ranger have handled this?"



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Quantlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez le ici !
Reply | Threaded
Open this post in threaded view
|

Re: Re: piecewise flat forward algorithm

Luigi Ballabio
In reply to this post by David Palmer-2
On 07/04/2005 03:30:53 PM, David Palmer wrote:
> In the real world, negative rates occur when the spot rate is below
> the inflation rate. This happens enough that it cannot be ignored.  
> The forward rates truly contain all market assumptions regarding the
> inflation rate and the predicted response to reinvestment! Sorry for
> this programmatically useless information.

However, it is useful for putting things in context.

> Since I cannot get MSVC to compile QL due to it telling me it cannot
> find the calendar libraries, I can be of no more help.

Do you have more details? What VC version? What error do you get  
exactly?

Later,
        Luigi

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

The purpose of abstraction is not to be vague, but to create a new
semantic level in which one can be absolutely precise.
-- W.E. Dijkstra



Reply | Threaded
Open this post in threaded view
|

Re: Re: piecewise flat forward algorithm

Luigi Ballabio
In reply to this post by Adjriou Belak
On 07/04/2005 09:17:07 PM, Adjriou Belak wrote:
> I agree with you but this option makes the downward curve impossible.

A downward curve is possible---I bootstrap them all the time :)

If QL_NEGATIVE_RATES is not defined, the algorithm should just prevent  
discount factors from being increasing. If discount factors were to  
increase, i.e., df(t1) < df(t2) for t1 < t2, this would imply a  
negative forward rate---the formula being r = [df(t1)/df(t2)-1]/(t2-t1)

Decreasing positive rates should not be excluded if they result in  
decreasing discount factors. If your 6% 2-year and 4% 3-year rates  
trigger an exception, this probably means they imply not only downward  
rates, but also a negative 2-3 years forward rate.

This said, you can allow negative rates---if you're using Linux, Mac OS  
X, Cygwin or MSYS, just configure with
./configure --enable-negative-rates
If you're on some other platform, edit ql/userconfig.hpp and uncomment  
the line
#define QL_NEGATIVE_RATES 1
so that the symbol is defined. This will allow you to bootstrap---I  
just tested your example and it worked.

Later,
        Luigi

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

There is no opinion so absurd that some philosopher will not
express it.
-- Marcus Tullius Cicero, "Ad familiares"