|
From: Luigi B. <lui...@gm...> - 2020-06-08 10:08:02
|
Yes and yes. Luigi On Mon, Jun 8, 2020 at 11:44 AM Philippe Hatstadt < phi...@ex...> wrote: > Thanks Luigi. > Two quick follow up questions; > 1. Does dirryPrice() work for an amortizing bond where I set the cash > flows myself, albeit as QL.Bond()? > 2. Does dirtyPrice() have the lazy NPV property? > > Regards > > Philippe Hatstadt > +1-203-252-0408 > pha...@ma... > https://www.linkedin.com/in/philippe-hatstadt > > > On Jun 8, 2020, at 2:43 AM, Luigi Ballabio <lui...@gm...> > wrote: > > > Hello, > that's correct. With the evaluation date set to the value date, the > bonds will take care of calculating the settlement date (you can check that > by calling bond.settlementDate() without arguments once you set the date). > To avoid confusion, I suggest you ignore the NPV() method and use > dirtyPrice() instead, which always discounts to the settlement date. > > Luigi > > > On Sun, Jun 7, 2020 at 9:41 PM Philippe Hatstadt < > phi...@ex...> wrote: > >> Thanks Mike. >> In my calculations, I was blipping the cleanPrice of a bond by its dv01, >> but I was unsure whether I had to set the evaluationDate() to settle_date >> to make sure the bond helpers understood my quote to be as of the >> settlement date. it appears that this is not impacted by the >> evaluationDate(), which is the correct design. So going forward, I see no >> reason to set the evaluationDate() to anything other than the trade date to >> get the correct numerical partial dv01s. >> Thanks >> >> Regards >> >> Philippe >> >> >> On Sun, Jun 7, 2020 at 2:28 PM Mike DelMedico <mik...@gm...> >> wrote: >> >>> Reference date = date which has discount factor of 1.0 >>> >>> So if you build a curve say with data from Tokyo open tonight, which is >>> for trade date Monday June 8, then 6/8/20 should be your reference date. >>> The settlement date of any instruments can and usually will be a different >>> date. >>> >>> I would assume that all the NPV calculations are discounting back to >>> reference date. >>> >>> - Mike >>> >>> On Sun, Jun 7, 2020 at 11:33 Philippe Hatstadt < >>> phi...@ex...> wrote: >>> >>>> 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>. >>>> _______________________________________________ >>>> 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>. >> > > > > 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>. > |