|
From: Sumit S. <su...@mo...> - 2021-03-02 20:32:03
|
Thanks a lot Francois. I set the day_count to the following.. day_count = ql.ActualActual(ql.ActualActual.Bond, schedule) I then managed to match the cashflows. Regards Sumit On Mon, 1 Mar 2021 at 11:52, Francois Botha <ig...@gm...> wrote: > Hi Sumit, > > I'm not very familiar with all the details of other countries' treasury > bonds, but are you sure that the first coupon is only a partial coupon > payment instead of the full 0.8125 ? > > If I enter a bond issue date of e.g. 2020-06-15 in my Schedule > constructor, then all the bond coupons are 0.8125 and I get an accrued > interest amount on settlement date 2021-02-23 of 0.3125. However, I also > get a yield of 0.17% at settlement date as you did originally. > > One more thing... as I say I'm not familiar with your bonds, but South > African government bonds use a business day convention of FOLLOWING, not > MODFOL. In your example, it wouldn't make a difference though. > > Hope this helps. > > regards, > Francois Botha > > > On Mon, 1 Mar 2021 at 13:27, Sumit Sengupta <su...@mo...> > wrote: > >> Just a follow up. I made this change to the day_count which seems to have >> resolved the cashflows. >> *day_count = ql.ActualActual(ql.ActualActual.Bond,schedule)* >> >> However, the accrued amount looks incorrect. >> fixedRateBond.accruedAmount() gives me a value of 0.004 which is far too >> small. It should be in the region of around 0.31 >> >> Any help would be appreciated.. >> >> Thanks, >> Sumit >> >> On Mon, 1 Mar 2021 at 11:08, Sumit Sengupta <su...@mo...> >> wrote: >> >>> Hi, >>> >>> I have the following code to calculate the yield of a Treasury bond. >>> >>> The issue I have is the code gives a yield of 0.17% - which is much >>> higher than the expected 0.13% >>> >>> Looking at the cashflows, it gives me the below.... >>> Date Amount Expected >>> Date(15,6,2021) 0.5031 >>> Date(15,12,2021) 0.8147 0.8125 >>> Date(15,6,2022) 0.8103 0.8125 >>> Date(15,12,2022) 0.8147 0.8125 >>> Date(15,12,2022) 100 >>> Any thoughts? >>> >>> Thanks, >>> Sumit >>> >>> calc_date = ql.Date(22,2,2021) >>> ql.Settings.instance().evaluationDate = calc_date >>> day_count = ql.ActualActual() >>> calendar = ql.UnitedStates() >>> bussiness_convention = ql.ModifiedFollowing >>> end_of_month = True >>> settlement_days = 1 >>> face_amount = 100 >>> coupon_frequency = ql.Period(ql.Semiannual) >>> >>> price = 102.625 >>> coupon = 1.625/100 >>> maturity_date = ql.Date(15, 12, 2022) >>> # issue_date = ql.Date(1, 2, 2021) >>> coupon_frequency = ql.Period(6, ql.Months) >>> >>> schedule = ql.Schedule(calc_date, >>> maturity_date, >>> coupon_frequency, >>> calendar, >>> bussiness_convention, >>> bussiness_convention, >>> ql.DateGeneration.Backward, >>> end_of_month) >>> fixedRateBond = ql.FixedRateBond( >>> settlement_days, >>> face_amount, >>> schedule, >>> [coupon], >>> ql.ActualActual() >>> ) >>> yld = fixedRateBond.bondYield(price, ql.ActualActual(),ql.Compounded, >>> ql.Semiannual) >>> yld * 100 >>> [x.amount()for x in fixedRateBond.cashflows()] >>> >>> >>> >>> -- >>> Mosaic Smart Data >>> >>> mobile +44 (0)7961839363 >>> su...@mo... >>> 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom >>> www.mosaicsmartdata.com >>> >> >> >> -- >> Mosaic Smart Data >> >> mobile +44 (0)7961839363 >> su...@mo... >> 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom >> www.mosaicsmartdata.com >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > -- Mosaic Smart Data mobile +44 (0)7961839363 su...@mo... 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom www.mosaicsmartdata.com |