I am trying to build a quarterly forward curve with 3 month USD Libor swap rates from 1Y to 50Y as inputs.
From other posts I have looked at, I have managed to come up with this code so far:
terms =['1', '2', '3', '4', '5', '6', '7', '8',
'9', '10', '12', '15', '20', '25', '30', '40', '50']
rate = [0.17, 0.17800000000000002, 0.244, 0.364, 0.499,
0.6409999999999999, 0.773, 0.887, 0.987, 1.074, 1.214, 1.355,
1.4809999999999999, 1.5390000000000001, 1.567,
1.527, 1.45]
LIBOR= ql.IborIndex('USDLibor', ql.Period('3M'), 2, ql.USDCurrency(), ql.UnitedStates(), ql.ModifiedFollowing, True, ql.Actual360())
helpers = [] # Helpers
helpers.append( ql.DepositRateHelper(0, ql.USDLibor(ql.Period('50Y')))) # changed from one year
helpers.append( ql.SwapRateHelper(0.06, ql.UsdLiborSwapIsdaFixAm(ql.Period('3m')))
)
curve = ql.PiecewiseLogCubicDiscount(0, ql.TARGET(), helpers, day_count)
curve.enableExtrapolation()
all_days = ql.MakeSchedule(
curve.referenceDate(),
curve.maxDate(),
ql.Period('3M')
)
rates_fwd = [
curve.forwardRate(d, calendar.advance(d,90,ql.Days), day_count, ql.Simple).rate()
for d in all_days
]
Not sure if the code above is correct, but it seems to work. The problem is that it's not using my input terms and rate. Anyone know how a way around this?