|
From: Philippe H. <phi...@ex...> - 2020-06-07 16:29:33
|
Luigi, what do you mean by "reference date" of the curve? The odd behavior I am observing is that if I build a curve with 2y, 3y, 5y, 7y, 10y and 30y US treasuries, and then I manually blip the 2y point to compute a key rate dv01, I would expect that only the 2y price is impacted. This is by setting as follows: ql.Settings.instance().evaluationDate = settle_date. To be 100% clear, I am repricing the bonds used to build the curve on the curve itself via a PricingEngine, not using bond math. However, the behavior I observe is that all maturities are slightly impacted by blipping the 2y price used to build the curve, whereas for instance, the 5y is not impacted by blipping the 3y, and the 10y is not impacted by clipping the 3y or the 5y. Furthermore, I set the yield on the 2y to zero, in which case the impact was zero. So my conclusion is that although I set the evaluationDate to settle date, the NPV() method discounts to trade_date, and since the first instrument I use to build my curve is the 2y, then the discount factor from trade date to settle date is only impacted by the 2y yield. Lastly, if I do ql.Settings.instance().evaluationDate = trade_date, then everything works as expected. However, this is exactly the behavior I would not expect, as I would only expect the 2y sensitivity to impact valuation Date based on settle_date, in which case all discounting from tared date to settle date is irrelevant. So I am utterly confused by how to use evaluationDate to discount properly to either trade or settle date with the NPV() method. Data is below, i highlighted in yellow the "anomaly", which would be expected if evaluationDate was set to trade date and not settle date. evaluationDate = settle date 2y 3y 5y 7y 10y 30y 2y -192.38 -0.27 -0.28 -0.28 -0.27 -0.27 3y 0.00 -295.21 0.00 0.00 0.00 0.00 5y 0.00 0.00 -488.57 0.00 0.00 0.00 7y 0.00 0.00 0.00 -679.34 0.00 0.00 10y 0.00 0.00 0.00 0.00 -960.92 0.00 30y 0.00 0.00 0.00 0.00 0.00 -2,404.86 evaluationDate = trade date 2y 3y 5y 7y 10y 30y 2y -191.12 0.00 0.00 0.00 0.00 0.00 3y 1.26 -295.48 0.00 0.00 0.00 0.00 5y 1.26 0.00 -488.85 0.00 0.00 0.00 7y 1.26 0.00 0.00 -679.61 0.00 0.00 10y 1.26 0.00 0.00 0.00 -961.17 0.00 30y 1.26 0.00 0.00 0.00 0.00 -2,405.04 Philippe On Fri, May 29, 2020 at 3:31 PM Luigi Ballabio <lui...@gm...> wrote: > Philippe, > bond.NPV() discounts to the reference date of the discount curve. > bond.dirtyPrice() discounts to the settlement, and thus it does hold that > dirtyPrice() - accruedInterest() equals cleanPrice(). As you say, the same > doesn't hold for NPV. > > Hope this helps, > Luigi > > > On Fri, May 29, 2020 at 9:26 PM Philippe Hatstadt < > phi...@ex...> wrote: > >> Peter & others, >> Is it 100% a fact that NPV() discounts to today and not to settle date? >> because I was trying to reconcile NPV() - accruedInterest() versus >> cleanPrice() but that should not work if they don't have the same >> settlement date >> >> >> Regards >> >> Philippe >> >> >> On Fri, May 29, 2020 at 8:49 AM Peter Caspers <pca...@gm...> >> wrote: >> >>> I believe helper.bond().cleanPrice() returns the (clean) price on the >>> curve, but as of the bond’s settlement date, typically this is today + 2bd. >>> NPV() returns the (dirty) price as of today on the other hand. Could that >>> explain the difference you see? >>> BR, Peter >>> >>> On 29 May 2020, at 03:34, Philippe Hatstadt < >>> phi...@ex...> wrote: >>> >>> One unanswered question is whether helper.bond().cleanPrice() is >>> supposed to return the clean price of the helper priced on the curve, or >>> just the cleanPrice parameter that was used to build the helper? >>> Given that it matches to 6 digits of precision the input quote >>> clesan price, I assume it is not based on valuation on the curve, >>> which should be equal to NPV(0 - accruedInterest but I would be keen to >>> know. >>> >>> Regards >>> >>> Philippe >>> >>> >>> On Thu, May 28, 2020 at 5:06 PM Mike DelMedico <mik...@gm...> >>> wrote: >>> >>>> Without looking at your code I would guess is a convention thing when >>>> you pass instrument specs to the ratehelper. Day counter, calendar, and >>>> coupon frequency come to mind? Maybe try gathering the cash flows off the >>>> bond object and see if they match what you expect? >>>> >>>> -Mike >>>> >>>> >>>> >>>> On Thu, May 28, 2020 at 15:34 Philippe Hatstadt < >>>> phi...@ex...> wrote: >>>> >>>>> I am building a US treasury curve from on the run 2/3/5/7/10/30y US >>>>> bonds, via tradition bond helper list and so on. How can I tell the quality >>>>> of the fit of the curve? Since it's a straight bootstrapping with >>>>> PiecewiseFlatForward, I would expect the repricing to be exact. >>>>> In order to do that, I am doing first helper.bond().NPV(), which for >>>>> the 30y bond gives me a price of 97.0322, whereas if I do >>>>> helper.bond().cleanPrice(), I get 97.015625. >>>>> Here is the issue: the latter price is *exactly* the input price that >>>>> I entered, however, the difference between NPV() and cleanPrice() is not >>>>> equal to the correct accrued interest of 0.03767 but equal to 0.01669. >>>>> So either (a) helper.bond().cleanPrice() only returns the quote that >>>>> was entered, but not the clean price of the bond calculated on the curve, >>>>> or (b) the curve construction does not reprice the helper bond exactly, >>>>> thence the incorrect value of 0.01699 above. >>>>> So I am looking for some guidance on how to evaluate the exactitude of >>>>> the curve building? >>>>> >>>>> Regards >>>>> >>>>> Philippe >>>>> >>>>> >>>>> >>>>> Brokerage services offered through Exos Securities LLC, member of SIPC >>>>> <http://www.sipc.org/> / FINRA <http://www.finra.org/>. For important >>>>> disclosures, click here <https://www.exosfinancial.com/disclosures>. >>>>> _______________________________________________ >>>>> QuantLib-users mailing list >>>>> Qua...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>>>> >>>> >>> >>> >>> Brokerage services offered through Exos Securities LLC, member of SIPC >>> <http://www.sipc.org/> / FINRA <http://www.finra.org/>. For important >>> disclosures, click here <https://www.exosfinancial.com/disclosures>. >>> _______________________________________________ >>> QuantLib-users mailing list >>> Qua...@li... >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>> >>> >>> >> >> >> Brokerage services offered through Exos Securities LLC, member of SIPC >> <http://www.sipc.org/> / FINRA <http://www.finra.org/>. For important >> disclosures, click here <https://www.exosfinancial.com/disclosures>. >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > -- Brokerage services offered through Exos Securities LLC, member of SIPC <http://www.sipc.org/> / FINRA <http://www.finra.org/>. For important disclosures, click here <https://www.exosfinancial.com/disclosures>. |