Bond price and yield
Full and flat price and accrued interest of a fixed-coupon bond from its yield, and its yield to maturity, to a call and to worst from its price.
- Model id
fixed_income.bond_pricing, 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
- Full (dirty) price at settlement
full_price - The j-th remaining cash flow: a coupon, or the last coupon and the redemption
- Yield to maturity per year, compounded at the coupon frequency
yield_to_maturity - Coupons per year
frequency - The fraction of a coupon period from settlement to the next coupon
- Accrued interest
accrued_interest - Face value
face_value - Annual coupon rate
coupon_rate - The year fraction from the previous coupon date to settlement, by the day count
- Flat (clean) price: the full price less accrued interest
flat_price - Yield to worst
yield_to_worst - Yield to maturity
yield_to_maturity - Yield to the k-th call date
yield_to_call
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
Full and flat price from a yield (price_from_yield): 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 | Full and flat price from a yield | |
Yield to maturityyield_to_maturityrate · [-0.1, 1] | rate | [-0.1, 1] | Yield to maturity per year, compounded at the coupon frequency |
Conventionconventiontext | text | Discounting over the first fraction of a period: compound (street) or simple interest (treasury, 31 CFR Part 356 Appendix B) |
Yield to maturity from a price (yield_from_price): 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 | |
Calculationcalculationtext | text | Yield to maturity from a price | |
Pricepricemoney · (0, 1e+15] | money | (0, 1e+15] | Price of the face value held (per 100 by default) |
Price typeprice_typetext | text | Whether the price excludes (flat) or includes (full) accrued interest | |
Conventionconventiontext | text | Discounting over the first fraction of a period: compound (street) or simple interest (treasury, 31 CFR Part 356 Appendix B) |
Yield to a call date (yield_to_call): 16 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 | Yield to a call date | |
Pricepricemoney · (0, 1e+15] | money | (0, 1e+15] | Price of the face value held (per 100 by default) |
Price typeprice_typetext | text | Whether the price excludes (flat) or includes (full) accrued interest | |
Call datecall_datedate | date | Coupon date on which the bond is called | |
Call pricecall_pricemoney · [1, 200] | money | [1, 200] | Amount paid on the call, per 100 of face value |
Conventionconventiontext | text | Discounting over the first fraction of a period: compound (street) or simple interest (treasury, 31 CFR Part 356 Appendix B) |
Lowest yield over the calls and maturity (yield_to_worst): 16 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 | Lowest yield over the calls and maturity | |
Pricepricemoney · (0, 1e+15] | money | (0, 1e+15] | Price of the face value held (per 100 by default) |
Price typeprice_typetext | text | Whether the price excludes (flat) or includes (full) accrued interest | |
Call datescall_datesdate (array) · length min 1, max 50 | date (array) | length min 1, max 50 | Coupon dates on which the bond may be called |
Call pricescall_pricesmoney (array) · length min 1, max 50; each [1, 200] | money (array) | length min 1, max 50; each [1, 200] | Amount paid on each call, per 100 of face value |
Conventionconventiontext | text | Discounting over the first fraction of a period: compound (street) or simple interest (treasury, 31 CFR Part 356 Appendix B) |
Outputs
Full and flat price from a yield (price_from_yield): 6 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Full and flat price from a yield | |
Full pricefull_pricemoney · [0, 1e+15] | money | [0, 1e+15] | Full (dirty) price at settlement, of the face value held (per 100 by default) |
Flat priceflat_pricemoney · [-1e+15, 1e+15] | money | [-1e+15, 1e+15] | Flat (clean) price, of the face value held (per 100 by default): the full price less accrued interest |
Accrued interestaccrued_interestmoney · [0, 2e+09] | money | [0, 2e+09] | Interest accrued up to settlement |
Next coupon datenext_coupon_datedate | date | First payment after settlement | |
Paymentspaymentscount · [1, 1201] | count | [1, 1201] | Payments remaining after settlement |
Yield to maturity from a price (yield_from_price): 5 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Yield to maturity from a price | |
Yield to maturityyield_to_maturityrate · [-0.1, 1] | rate | [-0.1, 1] | Yield to maturity that gives the price |
Full pricefull_pricemoney · [0, 1e+15] | money | [0, 1e+15] | Full (dirty) price at settlement, of the face value held (per 100 by default) |
Flat priceflat_pricemoney · [-1e+15, 1e+15] | money | [-1e+15, 1e+15] | Flat (clean) price, of the face value held (per 100 by default): the full price less accrued interest |
Accrued interestaccrued_interestmoney · [0, 2e+09] | money | [0, 2e+09] | Interest accrued up to settlement |
Yield to a call date (yield_to_call): 3 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Yield to a call date | |
Yield to callyield_to_callrate · [-0.1, 1] | rate | [-0.1, 1] | Yield if the bond is called on the call date |
Full pricefull_pricemoney · [0, 1e+15] | money | [0, 1e+15] | Full (dirty) price at settlement, of the face value held (per 100 by default) |
Lowest yield over the calls and maturity (yield_to_worst): 5 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Lowest yield over the calls and maturity | |
Yield to worstyield_to_worstrate · [-0.1, 1] | rate | [-0.1, 1] | Lowest of the yield to maturity and to each call |
Worst dateworst_datedate | date | Call or maturity date that gives it | |
Yield to maturityyield_to_maturityrate · [-0.1, 1] | rate | [-0.1, 1] | Yield to maturity |
Full pricefull_pricemoney · [0, 1e+15] | money | [0, 1e+15] | Full (dirty) price at settlement, of the face value held (per 100 by default) |
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 price of 95.6705 per 100 of face value.
Example five_year_annual. Inputs:
{
"calculation": "price_from_yield",
"convention": "street",
"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:
{
"accrued_interest": 0,
"calculation": "price_from_yield",
"flat_price": 95.67052332936917,
"full_price": 95.67052332936917,
"next_coupon_date": "2027-01-15",
"payments": 5
}Assumptions
- Coupons are fixed and paid f times a year on dates stepped back from the maturity; a regular coupon is c/f of the face value, and an irregular first coupon is the day count's fraction of it.
- The yield compounds at the coupon frequency. Street convention discounts the fraction w of a period to the first payment by (1 + y/f)^w; the treasury convention uses simple interest, 1 + w y/f, as 31 CFR Part 356 Appendix B does.
- Accrued interest runs from the previous coupon date, or from the issue date in an irregular first period, under the bond's day count.
- A call is exercised on a coupon date at the call price per 100 of face value, after that date's coupon is paid.
- Payment dates are not adjusted for business days.
Limitations
- Yields are solved in [-0.1, 1]. A price no yield in that range gives raises DomainError, including in yield_to_worst a call whose yield is below -0.1; a call whose yield is above 1 is skipped there, with a warning.
- Only a first period may be irregular; odd last periods, floating or step-up coupons, sinking funds, and ex-dividend periods are out of scope.
- Day counts are ACT/ACT (ICMA), US 30/360 and 30E/360. A regular coupon is c/f, and payments after the first are whole periods apart, even where a 30/360 count of a period touching a February month end is not 360/f; QuantLib, which sums each period's 30/360 fraction, differs there.
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
- US Department of the Treasury (2022). 31 CFR Part 356, Appendix B: Formulas and Tables. Electronic Code of Federal Regulations. https://www.ecfr.gov/current/title-31/subtitle-B/chapter-II/subchapter-B/part-356/appendix-Appendix%20B%20to%20Part%20356 (Section I (computation of interest) and section II, paragraphs A-G (non-indexed yield to price, with examples))
- Fabozzi, F. J. (2005). Fixed Income Mathematics: Analytical and Statistical Techniques, 4th ed. McGraw-Hill. https://openlibrary.org/isbn/9780071460736 (Chapter 5 (the price of a bond, between coupon dates included)). ISBN 9780071460736
- QuantLib (2026). BondFunctions and FixedRateBond. QuantLib 1.43 reference. https://www.quantlib.org/reference/struct_quant_lib_1_1_bond_functions.html (BondFunctions::cleanPrice, dirtyPrice, accruedAmount and yield)
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.bond_pricing/run- MCP tool
fixed_income_bond_pricing, orrun_modelwith the model's id; both give the same result. Connect an assistant- Command line
pyeconomics models run fixed_income.bond_pricing --help
The worked example, from Python and from the command line:
import pyeconomics
inputs = {
"calculation": "price_from_yield",
"convention": "street",
"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.bond_pricing", inputs)
print(result.to_json())
pyeconomics models run fixed_income.bond_pricing --inputs - <<'JSON'
{
"calculation": "price_from_yield",
"convention": "street",
"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