|
From: Luigi B. <lui...@gm...> - 2023-12-01 10:33:52
|
Hello Philippe,
instead of NPV, use bond.cleanPrice() or bond.dirtyPrice() instead.
Those two methods take the settlement days into account.
Luigi
On Thu, Nov 30, 2023 at 1:24 AM Philippe Hatstadt via QuantLib-users <
qua...@li...> wrote:
> I am building a ql.YieldTermStructureHandle with US treasury bonds that
> settle T+1. Since the method is bootystrapping, I expect each bond sued to
> build the curve to repcie itself 100% accurateIy when pricing any of the
> bonds used to build the curve on such curve.
> To test that, I compute the bonds dirty price by first assigning a pricing
> engine via my_bond.set_pricing_engine_from_curve(curve_handle) and then
> calling my_bond.NPV(). While the above returns a value, it does not return
> a value exactly equal to the dirty price of the bond using the closed-form
> my_bond.dirtyPrice(*args, settle_date) method. the values differ by about
> 0.013, whihc is about euqal to 100 *(1-1/(1+.05/365)), meaning that the
> difference is about one day of discounting at a 5% rate, close to market
> rates.
> This strongly indicates that thre NPV() method discounts the cash flows to
> T+0 = trade_date, and not to the T+1 settle date.
> So how can I instruct my_bond.NPV() to use a given settle date? I looked
> in the documentation of both python and C++ and it doesn't seem like there
> is any way to do that?
> One thing I tried to do is ql.Settings.instance().evaluationDate =
> settle_date just before I call .NPV() but it does exactly the opposite and
> appears to add one more day of discounting instead of reducing it.
>
> Any advice is appreciated.
>
>
> Regards Philippe Hatstadt 203-252-0408 pha...@ma...
>
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|