|
From: David D. <nh...@gm...> - 2020-10-15 08:27:47
|
Hi Isilay,
You should keep your questions in this mailing list on the relevant subject
and shouldn't be asking this question under the subject "Release candidates
for QuantLib 1.20".
In any case, the problem is that you are asking for the bond cashflows on
past dates where you haven't provided an index fixing. The error message
actually identifies the problem.
You can either provide all the fixings and then you can query any cash
flows or query only the cashflows for future dates (you will have to
provide at least the fixing for the current period).
Example:
index.addFixing(ql.Date(26,6,2020), 0.05, True)
pd.DataFrame({
"date": [ c.date() for c in bond.cashflows() if c.date() > today],
"amount": [ c.amount() for c in bond.cashflows() if c.date() > today ]
})
On Thu, 15 Oct 2020 at 08:47, isilay erol <ero...@gm...> wrote:
> Dear all,
>
> I have a question about the last announced coupon rate for floating bond.
>
> When I run the following query, an error occurs like in the following.
>
> This error seems strange to me, because the requested date is too old.
>
> We expect that this bond should be repriced in June 2020, based on
> repricing every 6 months(semiannual).
>
> But the error is asking us for a date before the bond is issued. Can you
> help me?
>
> Thank you,
>
>
>
>
>
> RuntimeError: Missing MyIndex6M Actual/360 fixing for December 27th, 2018
>
>
>
> Query;
>
>
>
> import QuantLib as ql
>
>
>
>
>
> dates = [
>
> '30.12.2019', '30.12.2020',
>
> '30.12.2021', '30.12.2022', '30.12.2023', '30.12.2024', '30.12.2025']
>
> zeros = [
>
> 0.000000,
>
> 0.108326014217227, 0.10842920241869, 0.108326911551829,
> 0.108103450370549, 0.107821584741388, 0.107525270883584]
>
>
>
> today = ql.Date(30,ql.September,2020)
>
> ql.Settings.instance().evaluationDate = today
>
> qlDates = [ql.Date(dt, '%d-%m-%Y') for dt in dates]
>
> dayCounter = ql.Actual360()
>
> zCurve = ql.ZeroCurve(qlDates, zeros, ql.ActualActual(), ql.TARGET())
>
> yts = ql.RelinkableYieldTermStructureHandle()
>
> yts.linkTo(zCurve)
>
>
>
> ##Then, I instantiate the index to be used. The bond has semiannual
> coupons, Also, I set a past fixing for the current
>
> ##coupon (which, having fixed in the past, can’t be forecast).
>
>
>
> index = ql.IborIndex('MyIndex', ql.Period('6m'), 2, ql.TRYCurrency(),
> ql.TARGET(), ql.ModifiedFollowing, True, ql.Actual360(), yts)
>
> index.addFixing(ql.Date(30,6,2020), 0.05, True)
>
>
>
> ##The bond was issued before the evaluation date and will run for 5 years
> with
>
> ##semiannual coupons.
>
>
>
> issueDate = ql.Date(30,ql.December,2018)
>
> maturityDate = ql.Date(30,ql.June,2023)
>
> schedule = ql.Schedule(issueDate, maturityDate,
>
> ql.Period(ql.Semiannual), ql.TARGET(),
>
> ql.Following, ql.Following,
>
> ql.DateGeneration.Backward, False)
>
> bond = ql.FloatingRateBond(settlementDays = 2,
>
> faceAmount = 100,
>
> schedule = schedule,
>
> index = index,
>
> paymentDayCounter = ql.Actual360())
>
>
>
> dates = [ c.date() for c in bond.cashflows() ]
>
> cfs = [ c.amount() for c in bond.cashflows() ]
>
> DataFrame(list(zip(dates, cfs)),
>
> columns = ('date','amount'),
>
> index = range(1,len(dates)+1))
>
>
> On 14 Oct 2020 Wed at 19:08 Luigi Ballabio <lui...@gm...>
> wrote:
>
>> Hello everybody,
>> release candidates for QuantLib 1.20 are available at <
>> https://bintray.com/beta/#/quantlib/prerelease/QuantLib/1.20-RC?tab=files>.
>> If you have some spare cycles, please kick their tires and let me know if
>> there are any problems.
>>
>> Thanks,
>> Luigi
>>
>>
>> _______________________________________________
>> QuantLib-users mailing list
>> Qua...@li...
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|