Bond convexity
Convexity of a fixed-coupon bond from its yield, effective convexity off a spot curve, and the duration-and-convexity price-change estimate.
- Model id
fixed_income.convexity, version 2- Domain
- Fixed income
- Evidence
- standard
- Cost class
- light: A short numerical method; a hosted run may take up to 10 seconds.
Formula
Where
- Convexity, in years squared
convexity - Full price of the bond
full_price - Yield to maturity per year, compounded at the coupon frequency
yield_to_maturity - Coupons per year
frequency - Time to cash flow j, in coupon periods from settlement
- The j-th remaining cash flow
- Effective convexity
effective_convexity - The price off the spot curve z
- The spot curve
curve_rates - The parallel shift of the curve, up and down
bump - The change in yield
yield_change - Modified duration
modified_duration - The estimated relative change in price
estimated_change
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
Convexity from the yield (analytical): 12 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Settlementsettlementdate | date | Settlement date: the price is for this date | |
Maturitymaturitydate | date | Maturity date: the last coupon and redemption (for a bond with n years left, n years after settlement) | |
Coupon ratecoupon_raterate · [0, 1] | rate | [0, 1] | Annual coupon rate, paid in equal parts |
Frequencyfrequencytext | text | Coupons per year (also the yield's compounding) | |
Day countday_counttext | text | Day count for accrued interest and stubs | |
Face valueface_valuemoney · [0.01, 1e+09] | money | [0.01, 1e+09] | Face (par) value held: at 100, a price is per 100 of face value |
Redemptionredemptionmoney · [1, 200] | money | [1, 200] | Amount repaid at maturity per 100 of face value |
Issue dateissue_datedate | date | Date interest starts to accrue, when the first coupon period is irregular; omitted (null) for a regular schedule | |
First periodfirst_periodtext | text | Whether an irregular first period ends at the first coupon date after the issue date (short) or at the one after that (long) | |
End of monthend_of_monthflag | flag | Keep coupon dates at month ends when the maturity is one | |
Calculationcalculationtext | text | Convexity from the yield | |
Yield to maturityyield_to_maturityrate · [-0.1, 1] | rate | [-0.1, 1] | Yield to maturity per year, compounded at the coupon frequency |
Effective convexity off a spot curve (effective): 14 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Settlementsettlementdate | date | Settlement date: the price is for this date | |
Maturitymaturitydate | date | Maturity date: the last coupon and redemption (for a bond with n years left, n years after settlement) | |
Coupon ratecoupon_raterate · [0, 1] | rate | [0, 1] | Annual coupon rate, paid in equal parts |
Frequencyfrequencytext | text | Coupons per year (also the yield's compounding) | |
Day countday_counttext | text | Day count for accrued interest and stubs | |
Face valueface_valuemoney · [0.01, 1e+09] | money | [0.01, 1e+09] | Face (par) value held: at 100, a price is per 100 of face value |
Redemptionredemptionmoney · [1, 200] | money | [1, 200] | Amount repaid at maturity per 100 of face value |
Issue dateissue_datedate | date | Date interest starts to accrue, when the first coupon period is irregular; omitted (null) for a regular schedule | |
First periodfirst_periodtext | text | Whether an irregular first period ends at the first coupon date after the issue date (short) or at the one after that (long) | |
End of monthend_of_monthflag | flag | Keep coupon dates at month ends when the maturity is one | |
Curve tenorscurve_tenorsyears (array) · length min 1, max 100; each (0, 100] | years (array) | length min 1, max 100; each (0, 100] | Tenors of the spot curve's nodes, in years, increasing |
Curve ratescurve_ratesrate (array) · length min 1, max 100; each [-0.1, 1] | rate (array) | length min 1, max 100; each [-0.1, 1] | Spot rate at each tenor, compounded at the coupon frequency; linear between nodes and flat beyond them |
Bumpbumprate · [1e-06, 0.01] | rate | [1e-06, 0.01] | Shift of the curve up and down for the central difference |
Calculationcalculationtext | text | Effective convexity off a spot curve |
Duration and convexity price-change estimate (price_change): 13 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Settlementsettlementdate | date | Settlement date: the price is for this date | |
Maturitymaturitydate | date | Maturity date: the last coupon and redemption (for a bond with n years left, n years after settlement) | |
Coupon ratecoupon_raterate · [0, 1] | rate | [0, 1] | Annual coupon rate, paid in equal parts |
Frequencyfrequencytext | text | Coupons per year (also the yield's compounding) | |
Day countday_counttext | text | Day count for accrued interest and stubs | |
Face valueface_valuemoney · [0.01, 1e+09] | money | [0.01, 1e+09] | Face (par) value held: at 100, a price is per 100 of face value |
Redemptionredemptionmoney · [1, 200] | money | [1, 200] | Amount repaid at maturity per 100 of face value |
Issue dateissue_datedate | date | Date interest starts to accrue, when the first coupon period is irregular; omitted (null) for a regular schedule | |
First periodfirst_periodtext | text | Whether an irregular first period ends at the first coupon date after the issue date (short) or at the one after that (long) | |
End of monthend_of_monthflag | flag | Keep coupon dates at month ends when the maturity is one | |
Calculationcalculationtext | text | Duration and convexity price-change estimate | |
Yield to maturityyield_to_maturityrate · [-0.1, 1] | rate | [-0.1, 1] | Yield to maturity per year, compounded at the coupon frequency |
Yield changeyield_changerate · [-0.02, 0.02] | rate | [-0.02, 0.02] | Change in the yield, in decimals (0.01 is 100 basis points) |
Outputs
Convexity from the yield (analytical): 3 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Convexity from the yield | |
Convexityconvexityratio · [0, 100000] | ratio | [0, 100000] | Second derivative of the price in the yield, over the price (years squared) |
Full pricefull_pricemoney · [0, 1e+15] | money | [0, 1e+15] | Full (dirty) price at settlement, of the face value held (per 100 by default) |
Effective convexity off a spot curve (effective): 3 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Effective convexity off a spot curve | |
Effective convexityeffective_convexityratio · [-100000, 100000] | ratio | [-100000, 100000] | (P_down + P_up - 2 P) / (P bump^2), in years squared |
Full pricefull_pricemoney · [0, 1e+15] | money | [0, 1e+15] | Full (dirty) price at settlement, of the face value held (per 100 by default) |
Duration and convexity price-change estimate (price_change): 8 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Duration and convexity price-change estimate | |
Modified durationmodified_durationyears · [0, 200] | years | [0, 200] | Modified duration at the yield |
Convexityconvexityratio · [0, 100000] | ratio | [0, 100000] | Convexity at the yield (years squared) |
Duration effectduration_effectratio · [-1000, 1000] | ratio | [-1000, 1000] | -D_mod x the yield change |
Convexity effectconvexity_effectratio · [-1000, 1000] | ratio | [-1000, 1000] | Half the convexity x the yield change squared |
Estimated changeestimated_changeratio · [-1000, 1000] | ratio | [-1000, 1000] | Relative price change estimated by duration and convexity |
Actual changeactual_changereturn · [-1, 100] | return | [-1, 100] | Relative change in the full price on repricing |
Approximation errorapproximation_errorratio · [-1000, 1000] | ratio | [-1000, 1000] | Actual change less the estimate |
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
A five-year bond with a 4% annual coupon at a 5% yield, settled on a coupon date: a convexity of 24.4724 years squared.
Example five_year_annual. Inputs:
{
"calculation": "analytical",
"coupon_rate": 0.04,
"day_count": "act_act_icma",
"end_of_month": true,
"face_value": 100,
"first_period": "short",
"frequency": "annual",
"issue_date": null,
"maturity": "2031-01-15",
"redemption": 100,
"settlement": "2026-01-15",
"yield_to_maturity": 0.05
}Outputs:
{
"calculation": "analytical",
"convexity": 24.472405046329648,
"full_price": 95.67052332936917
}Assumptions
- Times t_j are counted in coupon periods from settlement, as in fixed_income.bond_pricing; the yield compounds at the coupon frequency, under street convention.
- The spot curve is linear in its rates between nodes and flat beyond them, and is shifted in parallel.
- The bond has no embedded option, so its cash flows do not move with rates.
Limitations
- Effective convexity is a second difference: its rounding error grows as the bump shrinks, and its truncation error as it grows.
- Yield changes are limited to 200 basis points either way.
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
- Fabozzi, F. J. (2005). Fixed Income Mathematics: Analytical and Statistical Techniques, 4th ed. McGraw-Hill. https://openlibrary.org/isbn/9780071460736 (Chapter 13 (combining duration and convexity to measure price volatility)). ISBN 9780071460736
- QuantLib (2026). BondFunctions. QuantLib 1.43 reference. https://www.quantlib.org/reference/struct_quant_lib_1_1_bond_functions.html (BondFunctions::convexity)
Changelog
- Version 1: First version.
- Version 2: Correct US 30/360 long-stub accrual and discount times (#89).
Use it elsewhere
- Documentation
- The model's reference page
- REST API
GET or POST /v1/models/fixed_income.convexity/run- MCP tool
run_modelwith the model's id,fixed_income.convexity. Connect an assistant- Command line
pyeconomics models run fixed_income.convexity --help
The worked example, from Python and from the command line:
import pyeconomics
inputs = {
"calculation": "analytical",
"coupon_rate": 0.04,
"day_count": "act_act_icma",
"end_of_month": True,
"face_value": 100,
"first_period": "short",
"frequency": "annual",
"issue_date": None,
"maturity": "2031-01-15",
"redemption": 100,
"settlement": "2026-01-15",
"yield_to_maturity": 0.05,
}
result = pyeconomics.run("fixed_income.convexity", inputs)
print(result.to_json())
pyeconomics models run fixed_income.convexity --inputs - <<'JSON'
{
"calculation": "analytical",
"coupon_rate": 0.04,
"day_count": "act_act_icma",
"end_of_month": true,
"face_value": 100,
"first_period": "short",
"frequency": "annual",
"issue_date": null,
"maturity": "2031-01-15",
"redemption": 100,
"settlement": "2026-01-15",
"yield_to_maturity": 0.05
}
JSON