Floating Rate bond pricing related questions in QL and QLXL
Posted by christos.arvanitis on
URL: http://quantlib.414.s1.nabble.com/Floating-Rate-bond-pricing-related-questions-in-QL-and-QLXL-tp14476.html
Hello to everyone
I have some questions related in general with the pricing of Floating Bonds in QL and QLXL
1. Question
Started from the QL example FittedBondCurve.cpp I have managed to understand it and compiled fine and ok! Then i have altered a bit the code trying to test my understanding. I have altered the part of the shifted YC calculations for instance as:
for (Size k=0; k<LENGTH(mat_fix)-1; k++) { //start from 0
// retrieve quote object & value from instruments
Real P = instrumentsB[k]->quote()->value();
// retrieve bond object from instruments
const Bond& b = *instrumentsB[k]->bond();
// Calculate YTM
// BondFunctions is a structure containing Bond calculation methods
Rate ytm = BondFunctions::yield(b, // Bond object
P, // value clean price
dc_AA, // day-counter
Compounded, // compounding
Annual, // freq
today); // calculation date
// Calculate Duration
Time dur = BondFunctions::duration(b, // Bond object
ytm, // yield
dc_AA, // day-counter
Compounded, // compounding
Annual, // freq
Duration::Modified, // modified duration
today); // calculation date
// Calculate Convexity
Real convexity = BondFunctions::convexity(b,
ytm,
dc_AA,
Compounded,
Annual,
today);
// Rate shift
const Real bpsChange = 5.;
// dP = -dur * P * dY+0.5*P^2*convexity*dy^2
// duration correction
Real deltaP = -dur * P * (bpsChange/10000.)
// convexity correction
+0.5*pow(P,2)*convexity*pow(bpsChange/10000.,2);
// set calculate corrected values
quote[k+1]->setValue(P + deltaP);
}
the instumentsB is the ususal vector of bond helpers
the above code part fails to compile with the error
..\main.cpp:1409:14: error: 'quote' was not declared in this scope
2. Question
To price a floatter without cap/floor do you always have to specify the coupon pricer with zero vol?
3. Question
I have created a floating bond with say a cap and to price this bond I have to specify appart the YC the vol curve and passed to the coupon pricer
a. Appart the blackcoupon pricer what other pricer classes can i use
b. can you provide with a sample code for the stripping of capplets and calculation of vol surface
4. Question
I tried also to implement part of the calculation using the SWIG Python Bindinds. I have remarked that there are no available bindings for the Nelson siegel method. Is this because it is hard to expose the class to python?
5. Question
Then to go further i have tried to implement the full floating bond valuation in QLXL.
I have managed to reproduce the pricing and risk figures in accordance with Bloomberg but its worth to mention few questions i had
I have remarked the following things:
a. All setting being equal between the Bloomberg and qlxl i have remarked that the next coupon function for floatter has a permanet 1-2 days diff with bloomberg for some not all the floatters i have tested.
I will retest the settings again and repost back in case the issue persists
b. In QLXL only the blackiborcoupon pricer is exposed are there any other possibilities?
c. In QLXL there is no bindinds for the Nelson siegel method the only posiibility being the piecewise bootstrapping.Are they dificult to expose this class in xl?
I thing i have to stop here for the moment
Thank you very much in advance for your help
Regards
Christos