http://quantlib.414.s1.nabble.com/Floating-Rate-bond-pricing-related-questions-in-QL-and-QLXL-tp14476p14489.html
I'm not sure what you're doing here exactly. Did you copy the code
> Dear Luigi,
>
> Thank you very much for your reply.
>
> 1. It is clear to me by know that whenever i have a floater without a cap or
> floor no optionlet vol is needed to pass to the coupon pricer. In fact the
> coupon pricer is not neeeded at all.
>
> 2. For the cpp code issue i have to tell that i dont understand fully what
> is going on........!
> I have not manage to change properly the bond values with the changes
> induced by the bps change.
> As far as I understand setValue() is a modifier method for SimpleQuote
> I have instrumentsB which is a vector of shared_ptr<BondHelper> with a
> quoteHandle attached which is initiated by a SimpleQuote.
>
> Therefore it looked reasonable to me to mimic the original code from the
> example FittedBondCurve.cpp of QL examples which compiles without a problem
>
> Below I copy the part of the original code from the QL example and my code
> for reference
>
> If way is not compiling properly can you suggest a code piece which can
> change the bond quotes by applying the bps change?
>
>
> a. FittedBondCurve.cpp example loop across bonds
>
>
> for (Size k=0; k<LENGTH(lengths)-1; k++) {
>
> Real P = instrumentsA[k]->quote()->value(); // retrieve quote
> object & value from instrumentsA
> const Bond& b = *instrumentsA[k]->bond(); // retrieve bond
> object from instrumentsA
>
>
> // Calculate YTM
> // BondFunctions is a structure containing Bond calculation
> methods
> Rate ytm = BondFunctions::yield(b, // Bond object
> P, // value clean price
> dc, //
> day-counter
> Compounded, //
> compounding
> frequency, //
> Annual
> today); //
> calculation date
>
>
>
> // Calculate duration
> Time dur = BondFunctions::duration(b, // Bond object
> ytm, // yield
> dc, //
> day-counter
> Compounded, //
> compounding
> frequency, //
> Annual
>
> Duration::Modified, // modified duration
> today); //
> calculation date
>
>
>
> // Calculate convexity
> Real convexity = BondFunctions::convexity(
> b,
> ytm,
> dc,
> Compounded,
> frequency,
> today);
>
>
> // Rate shift
> const Real bpsChange = 5.;
>
> // dP = -dur * P * dY+0.5*P^2*convexity*dy^2
> Real deltaP = -dur * P * (bpsChange/10000.)+ // duration
> correction
> 0.5*pow(P,2)*convexity*pow(bpsChange/10000.,2); //
> conv correction
>
> // set calculate corrected values
> * quote[k+1]->setValue(P + deltaP);*
> }
>
>
> which compiles fine
>
>
> b. my code which in fact is a copy
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
>
> 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);
>
> }
>
>
> Thanks in advance for the support and help provided
>
> christos arvanitis
>
>
>
>
>
>
> --
> View this message in context:
http://quantlib.10058.n7.nabble.com/Floating-Rate-bond-pricing-related-questions-in-QL-and-QLXL-tp14476p14481.html> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> 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-usersGet down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.