[R-SIG-Finance] RQuantlib tsquote meaning of rates
Dirk Eddelbuettel
edd at debian.org
Mon Mar 24 18:12:31 CET 2014
On 24 March 2014 at 11:54, Kevin Owens wrote:
| I thought it was strange that the tsQuote argument used swap rates for
| longer tenors. These types of rates don't seem very easy to get, but
| maybe I'm misunderstanding something. I would have thought I could use
| the semi-annual bond equivalent rates, say, from the Treasury website.
|
| My questions are
| 1. How can I figure out how the swap rates are being used in Quantlib?
| 2. Is there any way to input bond equivalent rates into tsQuote, or as a
| DiscountCurve class?
| 3. Would I need to convert par rates to swap rates? If so, how?
It's a QuantLib question; the existing RQuantLib code more or less follows
the existing QuantLib examples and regression tests -- see directories
Examples/ and test-suite/ in the QuantLib sources. Some of those file have
comments, eg Examples/Swap/swapvaluation.cpp has
/*********************
*** MARKET DATA ***
*********************/
Calendar calendar = TARGET();
Date settlementDate(22, September, 2004);
// must be a business day
settlementDate = calendar.adjust(settlementDate);
Integer fixingDays = 2;
Date todaysDate = calendar.advance(settlementDate, -fixingDays, Days);
// nothing to do with Date::todaysDate
Settings::instance().evaluationDate() = todaysDate;
todaysDate = Settings::instance().evaluationDate();
std::cout << "Today: " << todaysDate.weekday()
<< ", " << todaysDate << std::endl;
std::cout << "Settlement date: " << settlementDate.weekday()
<< ", " << settlementDate << std::endl;
// deposits
Rate d1wQuote=0.0382;
Rate d1mQuote=0.0372;
Rate d3mQuote=0.0363;
Rate d6mQuote=0.0353;
Rate d9mQuote=0.0348;
Rate d1yQuote=0.0345;
// FRAs
Rate fra3x6Quote=0.037125;
Rate fra6x9Quote=0.037125;
Rate fra6x12Quote=0.037125;
// futures
Real fut1Quote=96.2875;
Real fut2Quote=96.7875;
Real fut3Quote=96.9875;
Real fut4Quote=96.6875;
Real fut5Quote=96.4875;
Real fut6Quote=96.3875;
Real fut7Quote=96.2875;
Real fut8Quote=96.0875;
// swaps
Rate s2yQuote=0.037125;
Rate s3yQuote=0.0398;
Rate s5yQuote=0.0443;
Rate s10yQuote=0.05165;
Rate s15yQuote=0.055175;
The file was setup a while back under a different curve, obviously. See the
QuantLib documentation for the exact convention or assumptions.
Cheers, Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the R-SIG-Finance
mailing list