|
From: Théodore M. <the...@gm...> - 2024-11-22 12:26:31
|
Hi,
I am trying to build a short term curve and would like to add a flat
time-dependent spread on top. I am however observing an odd feature where
there is a significant jump at the date where the spread starts, and I am
wondering if I am doing something wrong or if there's a bug. Please see
example code below and observe the 1 day forward rate on 9dec2024
specifically
import matplotlib.pyplot as plt
import QuantLib as ql
evaldate = ql.Date(22, 11, 2024)
ql.Settings.instance().setEvaluationDate(evaldate)
curve = ql.FlatForward(evaldate, ql.QuoteHandle(ql.SimpleQuote(0.01)),
ql.Actual360())
dates = [ql.Date(9, 12, 2024), ql.Date(16, 11, 2025)]
spreads = [ql.QuoteHandle(ql.SimpleQuote(s/10000) )for s in [13, 22]]
handle = ql.YieldTermStructureHandle(curve)
spreadcurve = ql.SpreadedBackwardFlatZeroInterpolatedTermStructure(handle,
spreads, dates)
spreadcurve.enableExtrapolation()
#fig, ax = utils.plot()
fwd_dates = [evaldate + ql.Period(i, ql.Days) for i in range(100)]
fwd_rates = [spreadcurve.forwardRate(fwd_dates[i - 1], fwd_dates[i],
ql.Actual360(), ql.Simple).rate() for i in
range(1, 100)]
#utils.plot_curve(ax, fwd_dates[1:], [(fwd_rates, '-')], format_rates=True)
Kind regards,
Théodore
|