Spot, par and forward curves
Bootstrap spot rates and discount factors from par yields, par yields from spot rates, and forward rates between maturities.
- Model id
fixed_income.curve_bootstrap, version 1- Domain
- Fixed income
- Evidence
- standard
- Cost class
- instant: A closed-form calculation; a hosted run may take up to 2 seconds.
Formula
Where
- Discount factor for a payment k periods from now
discount_factors - Par yield of the bond maturing in k periods
par_yields - Periods in a year
frequency - Spot rate for k periods, compounded f times a year
spot_rates - The same spot rate, continuously compounded
- Forward rate between the near and the far date
forward_rate - Years to the near date
near_years - Years to the far date
far_years - Spot rate to the near date
near_rate - Spot rate to the far date
far_rate
Each symbol's field is named beside it; the inputs and outputs, with their units and bounds, are under Variables, and the citations give each formula's source.
Variables
Rates, returns and yields are decimals: 0.05 is five percent. Bounds in brackets include their end; in parentheses they exclude it.
Inputs
Bootstrap spot rates from par yields (from_par): 4 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Bootstrap spot rates from par yields | |
Par yieldspar_yieldsrate (array) · length min 1, max 200; each [-0.1, 1] | rate (array) | length min 1, max 200; each [-0.1, 1] | Par yield at each tenor 1/f, 2/f, ... years |
Frequencyfrequencytext | text | Coupons per year of the par bonds, and the tenor spacing | |
Compoundingcompoundingtext | text | How spot and forward rates compound: at the frequency (periodic) or continuously |
Par yields and forwards from spot rates (from_spot): 4 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Par yields and forwards from spot rates | |
Spot ratesspot_ratesrate (array) · length min 1, max 200; each [-0.1, 1] | rate (array) | length min 1, max 200; each [-0.1, 1] | Spot (zero) rate at each tenor 1/f, 2/f, ... years |
Frequencyfrequencytext | text | Coupons per year of the par bonds, and the tenor spacing | |
Compoundingcompoundingtext | text | How spot and forward rates compound: at the frequency (periodic) or continuously |
Forward rate between two maturities (forward_rate): 7 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Forward rate between two maturities | |
Near ratenear_raterate · [-0.1, 1] | rate | [-0.1, 1] | Spot rate to the near maturity |
Near yearsnear_yearsyears · [0, 100] | years | [0, 100] | Near maturity, in years (0 for now) |
Far ratefar_raterate · [-0.1, 1] | rate | [-0.1, 1] | Spot rate to the far maturity |
Far yearsfar_yearsyears · (0, 100] | years | (0, 100] | Far maturity, in years |
Frequencyfrequencytext | text | Compounding frequency of periodic rates | |
Compoundingcompoundingtext | text | How spot and forward rates compound: at the frequency (periodic) or continuously |
Outputs
Bootstrap spot rates from par yields (from_par): 5 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Bootstrap spot rates from par yields | |
Tenorstenorsyears (array) · length max 200; each (0, 200] | years (array) | length max 200; each (0, 200] | Tenor of each point, in years |
Discount factorsdiscount_factorsratio (array) · length max 200; each (0, 1e+12] | ratio (array) | length max 200; each (0, 1e+12] | Discount factor at each tenor |
Spot ratesspot_ratesrate (array) · length max 200; each [-0.99, 10] | rate (array) | length max 200; each [-0.99, 10] | Spot (zero) rate at each tenor |
Forward ratesforward_ratesrate (array) · length max 200; each [-0.99, 10] | rate (array) | length max 200; each [-0.99, 10] | Forward rate over each period, ending at its tenor |
Par yields and forwards from spot rates (from_spot): 5 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Par yields and forwards from spot rates | |
Tenorstenorsyears (array) · length max 200; each (0, 200] | years (array) | length max 200; each (0, 200] | Tenor of each point, in years |
Discount factorsdiscount_factorsratio (array) · length max 200; each (0, 1e+12] | ratio (array) | length max 200; each (0, 1e+12] | Discount factor at each tenor |
Par yieldspar_yieldsrate (array) · length max 200; each [-0.99, 10] | rate (array) | length max 200; each [-0.99, 10] | Par yield at each tenor |
Forward ratesforward_ratesrate (array) · length max 200; each [-0.99, 10] | rate (array) | length max 200; each [-0.99, 10] | Forward rate over each period, ending at its tenor |
Forward rate between two maturities (forward_rate): 2 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Forward rate between two maturities | |
Forward rateforward_raterate · [-0.99, 10] | rate | [-0.99, 10] | Rate from the near to the far maturity |
Calculator
Run the model on your own inputs, starting from its example. Rates are decimals: 0.05 is five percent. The run goes to the pyeconomics API on this site: your values travel only in the request, and nothing is stored.
Loading the calculator…
Worked example
Three years of semiannual par yields.
Example treasury_par_curve. Inputs:
{
"calculation": "from_par",
"compounding": "periodic",
"frequency": "semiannual",
"par_yields": [0.04, 0.041, 0.042, 0.0425, 0.043, 0.0435]
}Outputs:
{
"calculation": "from_par",
"discount_factors": [
0.9803921568627451,
0.960217501993448,
0.9395173331675025,
0.9192629634462635,
0.8989849397527125,
0.878698650383075
],
"forward_rates": [
0.040000000000000084,
0.042021010505252636,
0.04406553896383517,
0.04406654140683878,
0.04511315550876494,
0.04617348475679015
],
"spot_rates": [
0.040000000000000084,
0.041010255101800175,
0.04202817530050558,
0.04253757618396721,
0.04305243242699409,
0.04357227702336333
],
"tenors": [0.5, 1, 1.5, 2, 2.5, 3]
}Assumptions
- The par yields are coupon rates of bonds paying f coupons a year, priced at par on a coupon date, one maturing at each tenor 1/f, 2/f, ... years.
- Spot and forward rates compound at the frequency, or continuously; a forward rate shares the compounding of the spot rates it comes from.
Limitations
- Par yields whose bootstrapped discount factor is not positive, and any rate outside [-0.99, 10], raise DomainError.
- Tenors are regular; interpolating between irregular instruments is out of scope (pyeconomics.core.curves interpolates zero rates).
Evidence
Status: standard. Textbook consensus, such as bond duration or the CAPM formula.
Every model declares one status: standard (textbook consensus), practitioner (a widely used convention), contested (under active debate), rejected (failed out of sample) or historical (a superseded methodology).
Syllabus
The 2027 CFA® Program's topic areas this model relates to, as factual tags. Each links to CFA Institute's page for its level; pyeconomics holds none of the curriculum's text.
Citations
- Hull, J. C. (2018). Options, Futures, and Other Derivatives, 10th ed. Pearson. https://openlibrary.org/isbn/9780134472089 (Chapter 4 (zero rates, par yields, bootstrapping and forward rates)). ISBN 9780134472089
- Fabozzi, F. J. (2005). Fixed Income Mathematics: Analytical and Statistical Techniques, 4th ed. McGraw-Hill. https://openlibrary.org/isbn/9780071460736 (Chapter 7 (the yield curve, spot rate curve and forward rates)). ISBN 9780071460736
Changelog
- Version 1: First version.
Use it elsewhere
- Documentation
- The model's reference page
- REST API
GET or POST /v1/models/fixed_income.curve_bootstrap/run- MCP tool
fixed_income_curve_bootstrap, orrun_modelwith the model's id; both give the same result. Connect an assistant- Command line
pyeconomics models run fixed_income.curve_bootstrap --help
The worked example, from Python and from the command line:
import pyeconomics
inputs = {
"calculation": "from_par",
"compounding": "periodic",
"frequency": "semiannual",
"par_yields": [0.04, 0.041, 0.042, 0.0425, 0.043, 0.0435],
}
result = pyeconomics.run("fixed_income.curve_bootstrap", inputs)
print(result.to_json())
pyeconomics models run fixed_income.curve_bootstrap --inputs - <<'JSON'
{
"calculation": "from_par",
"compounding": "periodic",
"frequency": "semiannual",
"par_yields": [0.04, 0.041, 0.042, 0.0425, 0.043, 0.0435]
}
JSON