|
From: Brian S. <bri...@gm...> - 2021-04-03 14:20:26
|
Hi,
I found out that I have to add a dummy quote to get this work. So I added -
myindex = Euribor6M(curveHandle)
myindex.addFixing(Date(27, 7, 2018), 0.00)
bond_schedule = Schedule(mydate,
mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
Unadjusted, DateGeneration.Forward, False)
[c.amount() for c in FloatingRateBond(0, 10000, bond_schedule ,
myindex, Actual360()).cashflows()]
[c.date() for c in FloatingRateBond(0, 10000, bond_schedule , myindex,
Actual360()).cashflows()]
However with this, I am getting strange result as all the coupon
payments are coming as zero.
Can you please help me to understand what went wrong in my code?
On Sat, 3 Apr 2021 at 14:39, Brian Smith <bri...@gm...> wrote:
>
> Hi,
>
> I want to extract all the cash flow amounts from a bond as defined below -
>
> from QuantLib import *
>
> mydate = Date(31, 1, 2018)
>
> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
> + Period("2y"), mydate + Period("3y")]
> spotsdate = [0, 0.25, 0.45, 0.65, 0.85]
>
> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
> Actual360(), Canada(), Linear(), Continuous))
>
> [c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate,
> mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
> Unadjusted, DateGeneration.Forward, False) , Euribor6M(curveHandle),
> Actual360()).cashflows()]
>
> However above code failed to achieve any result, but giving out below error -
>
> Traceback (most recent call last):File "<stdin>", line 1, in
> <module>File "<stdin>", line 1, in <listcomp>File
> "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py", line
> 9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError:
> Missing Euribor6M Actual/360 fixing for January 29th, 2018
>
> I wonder where the date January 29th, 2018 comes from and how to resolve this?
>
> Any pointer will be highly appreciated.
>
> Thanks for your time.
|