Re: pricing a floating rate bond

Posted by Steve on
URL: http://quantlib.414.s1.nabble.com/pricing-a-floating-rate-bond-tp14445p14482.html

Luigi,

I tried to use IborIndex to price the floating note. The result is about 0.0036% off from the correct answer. There are many factors that contribute to this discrepancy. But I think the main reason is that the forecastfixing is about 0.013% off from the index rate. Below are the code printing out forecastfixing and some of the index rate:
for(int i=0;i<AccuralStart.size();i++){
if(FRN13Wks->isValidFixingDate(AccuralStart[i]) && AccuralStart[i] < settlementDate){
FRN13Wks->addFixing(AccuralStart[i], IndexRate[i]);
junk << AccuralStart[i] << " +++ " << FRN13Wks->fixing(AccuralStart[i]) << " +++ " << IndexRate[i] << endl;
}
if(FRN13Wks->isValidFixingDate(AccuralStart[i]) && AccuralStart[i] >= settlementDate){
junk << AccuralStart[i] << " ``` " << FRN13Wks->forecastFixing(AccuralStart[i]) << " ``` " << IndexRate[i] << endl;
}
}

September 11th, 2012 +++ 0.001 +++ 0.001
September 12th, 2012 +++ 0.001 +++ 0.001
September 13th, 2012 +++ 0.001 +++ 0.001
September 14th, 2012 +++ 0.001 +++ 0.001
September 17th, 2012 +++ 0.001 +++ 0.001
September 18th, 2012 +++ 0.001 +++ 0.001
September 19th, 2012 ``` 0.00105014 ``` 0.001
September 20th, 2012 ``` 0.00105014 ``` 0.00105
September 21st, 2012 ``` 0.00105014 ``` 0.00105
September 24th, 2012 ``` 0.00105014 ``` 0.00105
September 25th, 2012 ``` 0.00105014 ``` 0.00105
September 26th, 2012 ``` 0.00105014 ``` 0.00105
September 27th, 2012 ``` 0.00105014 ``` 0.00105
September 28th, 2012 ``` 0.00105014 ``` 0.00105

Basically, the forcastfixing is CONSTANTLY 0.00000014 about the index rate after the settlement date, Sept 19th, 2012, all the way to the maturity date. Can you or anyone to help me to understand where 0.00000014 comes from?

Thanks


On Fri, Jul 19, 2013 at 5:49 PM, Luigi Ballabio <[hidden email]> wrote:
On Sat, Jul 13, 2013 at 1:25 AM, Steve <[hidden email]> wrote:
> I am trying to price a floating rate bond that depends on the rate of a
> Treasury instrument. For simplicity, the rate and the date are imported from
> the file. But I used IborIndex class for the rate of the instrument.
> Unsurprisingly, the result is way off. So I have a few questions on this
> topic:
>
> 1 is there an equivalent index class for the Treasury instrument, like
> IborIndex for LIBOR, in QuantLib?

Not as such.  You might use IborIndex as a proxy, provided that the
conventions match; for instance, the LIBOR rate is simply compounded,
with an Actual/360 day-count convention in the case of USD LIBOR.  As
far as I know, T-bills are quoted as a discount; how is the rate of
your Treasury instrument derived from that?  And instead of looking at
the price of the bond (that is, at the sum of the coupons, which
muddies things), have you tried first looking at forecast IborIndex
fixings to see if they match the rates you expect?

> 2 if the answer is no, is it possible to build a class like TreasuryIndex by
> extending InterestRateIndex? What would be the challenge in building
> TreasuryIndex?

You would have to implement the forecastFixing method so that it
returns the T-Bill rate. Basically, you'd have to be able to forecast
the rate off your treasury curve. (You'd also have to implement the
maturityDate method, but that's easy).

> 3 Is it possible to use IborIndex for a Treasury instrument by tweaking the
> calendar alone? What else needs to be done to make it work?

See above. It depends on how much the conventions differ.

> 4      Can someone point me to the right direction on how to leverage
> QuantLib classes to price a floating rate bond that uses a Treasury
> instrument as the index after a peek at the code?

If using IborIndex fails, inheriting from InterestRateIndex shouldn't
be that difficult. Once you have a rate class, you should be able to
use the existing classes as you did in your code.

Let me know how it works.

Later,
    Luigi


--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

code.txt (11K) Download Attachment