|
From: isilay e. <ero...@gm...> - 2020-10-08 08:55:28
|
Dear Ben,
Thank you for your quick answer.
I want to do my calculations on anaconda python.
At this point, what kind of a link should I proceed between the solution
you suggested and quantlibXL and python?
Can you give me a simple example of floating bond cashflow generation so
that I can visualize it better in my mind?
At this point, without the yield curve construction part (with a given Zero
coupon curve) how can I generate cashflow and index in the example below?
I don’t want to use this yield curve contruction part.
##forecast_curve = ql.RelinkableYieldTermStructureHandle()
##forecast_curve.linkTo(ql.FlatForward(today, 0.002, ql.Actual360(),
##ql.Compounded, ql.Semiannual))
##index = ql.Euribor6M(forecast_curve)
##index.addFixing(ql.Date(6,ql.August,2014), 0.002)
import QuantLib as ql
from pandas import DataFrame
today = ql.Date(8,ql.October,2014)
ql.Settings.instance().evaluationDate = today
forecast_curve = ql.RelinkableYieldTermStructureHandle()
forecast_curve.linkTo(ql.FlatForward(today, 0.002, ql.Actual360(),
ql.Compounded, ql.Semiannual))
index = ql.Euribor6M(forecast_curve)
index.addFixing(ql.Date(6,ql.August,2014), 0.002)
issueDate = ql.Date(8,ql.August,2014)
maturityDate = ql.Date(8,ql.August,2019)
schedule = ql.Schedule(issueDate, maturityDate,
ql.Period(ql.Semiannual), ql.TARGET(),
ql.Following, ql.Following,
ql.DateGeneration.Backward, False)
bond = ql.FloatingRateBond(settlementDays = 3,
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))
|