Bootstrap Term Structure Model
Overview
A bootstrapped term structure is a term structure where the yields are various points along the
curve are recursively measured, and then a curve is fit to those points. The method of fit is typically
a
cubic spline.
(see
curve estimation)
Curve Types
The bootstrap.py file can bootstrap the following curves, given a set of datapoints. (inlcuding with a set of spreads)
- PiecewiseLogLinearDiscount
- PiecewiseLogCubicDiscount
- PiecewiseSplineCubicDiscount
- PiecewiseLinearZero
- PiecewiseFlatForward
- PiecewiseLinearForward
Sample Code
data = {"date": "2026-08-10", "1M": 3.79, "1.5M": 3.8, "2M": 3.84, "3M": 3.89, "4M": 3.91, "6M": 4.0, "1Y": 4.04, "2Y": 4.25, "3Y": 4.31, "5Y": 4.41, "7Y": 4.56, "10Y": 4.72, "20Y": 5.25, "30Y": 5.25}
data2 = []
for key in data:
if key != 'date':
item = [key, data[key]]
data2.append(item)
pass
data3 =ty.term_data(data2)
curve = ts.BootstrappedCurve(type=ts.BootstrapTypes.PiecewiseLogLinearDiscount,day_count=ty.DAY_COUNT, data=data3)