|
From: Sumit S. <su...@mo...> - 2021-03-01 11:24:04
|
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 |