Excel YIELD function: bond yield from price API
The yield of a bond paying periodic coupons, from its price, as Excel's YIELD, proven correct to the last digit.
POST https://api.curatedapi.com/v1/calc/excel/yield
- Version 2
- MCP tool
calc_excel_yield - Try it in the browser
YIELD(settlement, maturity, rate, pr, redemption, frequency, [basis]): the yield at which PRICE gives pr. With one coupon or less left it is Microsoft's closed form; otherwise the root of the PRICE equation.
Formula
PRICE(settlement, maturity, rate, yield, redemption, frequency, basis) = pr
- Excel finds this value by iterating from a guess until it stops changing. Here the root of the same equation is pinned between two proven bounds, so the result is correctly rounded. When the equation has several roots, the one closest to guess is returned (Excel's iteration usually ends there) and all are listed.
- Arguments are named and ordered as in Excel. Excel computes in binary floating point; this API computes the exact value of the same formula and rounds it once, so it agrees with Excel to the digits Excel can show, and where Excel's own rounding error reaches the 15th digit this answer is the correct one.
- Dates are ISO 8601 (YYYY-MM-DD) from 1900-03-01 to 9999-12-31, so Excel's fictional 29 February 1900 never comes into play. Each date result also gives Excel's serial number (1900 date system).
Inputs
Send numbers as strings to keep every digit. options sets precision and rounding (see numbers and rounding).
| Input | Type | Description |
|---|---|---|
settlement required |
date (YYYY-MM-DD) | Settlement date (when the buyer gets the bond). |
maturity required |
date (YYYY-MM-DD) | Maturity date. |
rate required |
decimal (string) | Annual coupon rate as a decimal. A ratio of two decimals such as "0.08/12" is accepted. Allowed: >= 0 and <= 100. |
pr required |
decimal (string) | Clean price per 100 of face value. A ratio of two decimals such as "0.08/12" is accepted. Allowed: > 0 and <= 1000000. |
redemption required |
decimal (string) | Redemption value per 100 of face value. A ratio of two decimals such as "0.08/12" is accepted. Allowed: > 0 and <= 1000000. |
frequency required |
integer | Coupons per year: 1, 2 or 4. Allowed: >= 1 and <= 4. |
basis |
integer default 0 |
Day count basis: 0 US (NASD) 30/360; 1 Actual/actual; 2 Actual/360; 3 Actual/365; 4 European 30/360. Allowed: >= 0 and <= 4. |
options.rounding |
half_even | half_up | half_down | up | down | ceiling | floor | Rounding mode applied once to each result. Default half_even. |
options.decimals |
integer | Round results to this many digits after the decimal point. |
options.significant_digits |
integer | Round results to this many significant digits. |
Result
Under result in the answer, next to exactness, precision, inputs, formula, references and warnings.
| Result | Type | Description |
|---|---|---|
yield | decimal (string) | Annual yield as a decimal. |
coupons_remaining | integer | Coupons from settlement to maturity (N). |
Examples
Microsoft's example: 5.75% semiannual coupon priced at 95.04287
curl https://api.curatedapi.com/v1/calc/excel/yield \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"settlement": "2008-02-15",
"maturity": "2016-11-15",
"rate": "0.0575",
"pr": "95.04287",
"redemption": "100",
"frequency": 2,
"basis": 0,
"options": {"decimals": 3}
}'
{
"calculator": "excel/yield@2",
"result": {
"yield": "0.065",
"coupons_remaining": 18
},
"exactness": {
"yield": "rounded"
},
"precision": {
"rounding": "half_even",
"decimals": 3
},
"inputs": {
"settlement": "2008-02-15",
"maturity": "2016-11-15",
"rate": "0.0575",
"pr": "95.04287",
"redemption": "100",
"frequency": 2,
"basis": 0
},
"formula": "PRICE(settlement, maturity, rate, yield, redemption, frequency, basis) = pr",
"references": [
{
"title": "Microsoft Excel YIELD function",
"url": "https://support.microsoft.com/en-us/excel/functions/yield-function"
},
{
"title": "Microsoft YIELD function formulas (DAX reference, same definition as Excel)",
"url": "https://learn.microsoft.com/en-us/dax/yield-function-dax"
}
],
"warnings": []
}
References
- Microsoft Excel YIELD function
- Microsoft YIELD function formulas (DAX reference, same definition as Excel)
Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.
Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.