Nelson-Siegel Fitted Bond Curve
The Nelson-Siegel Model is the three-factor zero rate of Nelson and Siegel (1987): a level, a slope and one hump, with four parameters, a parsimonious form that fits the usual shapes of the yield curve.
The formula for the Nelson-Siegel Model builds the continuously compounded zero rate at a maturity of t years from the loadings of its factors. The slope loading \(L_{1}\) is 1 at the shortest maturity and decays to 0 at a speed set by the decay \(\tau_{1}\), and the curvature loading \(C_{1}\) is 0 at both ends and peaks in between:
\[L_{1} = \frac{1 - \exp\left(-\frac{t}{\tau_{1}}\right)}{\frac{t}{\tau_{1}}}\] \[C_{1} = L_{1} - \exp\left(-\frac{t}{\tau_{1}}\right)\]The zero rate y(t) is the level plus each factor times its loading, and the discount function discounts at it continuously:
\[y_{t} = \beta_{0} + \beta_{1} \cdot L_{1} + \beta_{2} \cdot C_{1}\] \[d_{t} = \exp\left(-y_{t} \cdot t\right)\]Where \(\beta_{0}\) is the level, the zero rate at an infinite maturity, \(\beta_{1}\) the slope, so that the shortest rate is \(\beta_{0} + \beta_{1}\), and \(\beta_{2}\) the curvature, a hump that peaks at about 1.8 times \(\tau_{1}\) years. It is the stiffest of the curves: its parameters are well identified and stable from day to day, but a single hump can miss the shape of the long end, which then shows up as a pattern in the residuals of the long bonds.
A constant maturity curve is quoted at a dozen maturities. Fitting the curve to the roughly 330 Treasury notes and bonds themselves gives the term structure that what trades implies, at every maturity, and measures each bond against it: a bond priced above the curve is rich, one priced below it cheap, the basis of relative value trading. The curve is a discount function d(t), the value today of 1 paid t years from now, and the methods differ in the shape they give it, from a parametric curve with a handful of parameters to a spline that follows the prices more closely.
The fit is the same for every discount function. Each bond’s price on the curve is its coupons and principal discounted with it:
\[\text{Model Price}_{i} = \sum \left(\text{CF}_{i,k} \cdot d(t_{i,k})\right)\]The parameters of the discount function minimise the weighted squared differences between these prices and the market prices, with weights inversely proportional to duration, as Gürkaynak, Sack and Wright (2007) fit the Federal Reserve’s Treasury curve:
\[\text{Objective} = \sum_{i=1}^{N} w_{i} \cdot (\text{Model Price}_{i} - P_{i})^{2}\] \[w_{i} = \frac{1}{D_{i}}\]Where \(P_{i}\) is the market price plus the accrued interest of bond i, \(\text{CF}_{i , k}\) its coupons and principal at times \(t_{i , k}\) in years, \(D_{i}\) its modified duration and N the number of bonds. A price error is about the duration times the price times the yield error, so the weights reduce the weight of the long bonds’ larger price errors, while still giving a basis point of a long bond more weight than one of a short bond (equal weight in yield would need weights of \(1 / D_{i}^{2}\)). The zero rates of the fitted curve are given annually compounded, while the parametric models are fitted on continuously compounded rates, so their parameters compare with the Federal Reserve’s; the instantaneous forward rate is continuously compounded, and the yields of the bonds are bond-equivalent, compounded twice a year, as the Treasury quotes them. A residual is the gap between a bond’s market price or yield and that on the curve: a positive price residual (a negative yield residual) marks a rich bond, a negative price residual a cheap one. Residuals reflect more than mispricing, such as the liquidity of the most recently issued bonds and the demand for particular bonds in the repo market.
Also known as: Nelson-Siegel curve, NS.
In the Finance Toolkit this is get_fitted_bond_curve with method="nelson_siegel", the same function as Fitted Bond Curve.
Example
Install the Finance Toolkit with pip install financetoolkit -U, then call get_fitted_bond_curve:
from financetoolkit import FixedIncome
fixedincome = FixedIncome()
fixedincome.get_fitted_bond_curve(method="nelson_siegel", date="2026-11-05")
| Parameter | Type | Description | Example |
|---|---|---|---|
method | str | The discount function. Options are: “svensson” (Svensson Model, the Nelson-Siegel-Svensson zero rate), “nelson_siegel” (Nelson-Siegel Model, the Nelson-Siegel zero rate), “exponential_spline” (Vasicek-Fong Exponential Spline, a sum of exponentials), “cubic_spline” (McCulloch Cubic Spline, a cubic B-spline). Defaults to “svensson”. | "svensson" |
maturities | float | str | list | None | The maturities to return the curve at, in years or as labels such as ‘6M’ (a list or a comma-separated string). Defaults to None, 6 months and 1, 2, 3, 5, 7, 10, 20 and 30 years. | ["3M", "6M"] |
date | str | None | The day of the prices (YYYY-MM-DD); a weekend or holiday uses the business day before it. Defaults to None, the latest day with prices. | "2025-03-31" |
residuals | bool | Whether to return every bond with its price and yield on the curve and its residuals instead of the curve. Defaults to False. | False |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the class. | 2 |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
Which returns:
| Maturity | Zero Rate | Discount Factor | Instantaneous Forward Rate |
|---|---|---|---|
| 0.5 | 0.0446 | 0.9784 | 0.0436 |
| 1.0 | 0.0447 | 0.9573 | 0.0439 |
| 2.0 | 0.0450 | 0.9158 | 0.0448 |
| 3.0 | 0.0455 | 0.8751 | 0.0461 |
| 5.0 | 0.0468 | 0.7957 | 0.0489 |
| 7.0 | 0.0481 | 0.7196 | 0.0516 |
| 10.0 | 0.0501 | 0.6135 | 0.0546 |
| 20.0 | 0.0544 | 0.3469 | 0.0584 |
| 30.0 | 0.0564 | 0.1928 | 0.0589 |
9 rows
References
- Paper Nelson, C.R. and Siegel, A.F. (1987). “Parsimonious Modeling of Yield Curves.” The Journal of Business, 60(4), 473-489.
- Paper Gürkaynak, R.S., Sack, B. and Wright, J.H. (2007). “The U.S. Treasury Yield Curve: 1961 to the Present.” Journal of Monetary Economics, 54(8), 2291-2304.
- Library Shares similar logic as QuantLib’s NelsonSiegelFitting (Nelson-Siegel Model)