Skip to content
TotalFinance

Price a bond

Price a fixed-rate bond from its yield and read duration, convexity and DV01, with the price–yield curve drawn.

Run it

Live, in your browser. Nothing leaves this page.

Local
5%

decimal · annualized

4.5%

decimal · annual

10

years · integer

Change any input; everything updates.

Clean price
96.1027
per 100 face
Modified duration
7.91914
% price change per 1% yield
Macaulay duration
8.11712
years
Convexity
75.2996
years²
DV01
0.0761051
price change per 1 bp, per 100 face
Price across yieldsThe curve bends: price rises more when yields fall than it falls when yields rise by the same amount. That curvature is convexity.
Yield 5.00%Par (100)
Show data (41 rows)
Yield to maturityClean price
1.00%133.228
1.20%131.009
1.40%128.834
1.60%126.701
1.80%124.609
2.00%122.557
2.20%120.545
2.40%118.572
2.60%116.636
2.80%114.738
3.00%112.876
3.20%111.05
3.40%109.259
3.60%107.502
3.80%105.779
4.00%104.088
4.20%102.429
4.40%100.802
4.60%99.2056
4.80%97.6394
5.00%96.1027
5.20%94.595
5.40%93.1156
5.60%91.664
5.80%90.2396
6.00%88.8419
6.20%87.4703
6.40%86.1242
6.60%84.8033
6.80%83.5069
7.00%82.2345
7.20%80.9857
7.40%79.76
7.60%78.557
7.80%77.3761
8.00%76.2169
8.20%75.0791
8.40%73.9621
8.60%72.8655
8.80%71.789
9.00%70.7321
Cash flows to maturityCoupons each period, then the coupon plus the 100 face value at maturity.
  • Coupon
  • Coupon + principal
2026-07-012028-01-032029-07-022031-01-012032-07-012034-01-022035-07-02Payment date
Show data (20 rows)
Payment dateCash flow · per 100 face
2026-07-012.25
2027-01-012.25
2027-07-012.25
2028-01-032.25
2028-07-032.25
2029-01-012.25
2029-07-022.25
2030-01-012.25
2030-07-012.25
2031-01-012.25
2031-07-012.25
2032-01-012.25
2032-07-012.25
2033-01-032.25
2033-07-012.25
2034-01-022.25
2034-07-032.25
2035-01-012.25
2035-07-022.25
2036-01-01102.25

Assumptions & conventions

What the calculation assumed, echoed by the library rather than hidden.

conventionsVersion
0.0.1
dayCount
30/360
compounding
actuarial
frequency
2
settlementDate
2026-01-01
businessDayConvention
modifiedFollowing

Diagnostics & warnings

No warnings. Engine, method and convergence details:

method
closed-form

Use it in your project

yieldMetrics returns prices, accrued interest, Macaulay and modified duration, convexity and DV01 at one yield, with the applied conventions echoed in assumptions. The bond itself is an ordinary object with its schedule and cash flows.

First call
import { bonds, yieldMetrics } from '@insiderfinance/totalfinance/fixed-income';

const bond = bonds.fixedRate({
  "issueDate": "2026-01-01",
  "maturityDate": "2036-01-01",
  "couponRate": 0.045,
  "frequency": "semiannual",
  "faceValue": 100,
  "dayCount": "30/360"
});
const result = yieldMetrics(bond, { settlementDate: '2026-01-01', yield: 0.05 });
console.log(result);
Output of this example
{
  "yield": 0.05,
  "dirtyPrice": 96.10270942858844,
  "cleanPrice": 96.10270942858844,
  "accruedInterest": 0,
  "macaulayDuration": 8.117119791414408,
  "modifiedDuration": 7.919141259916497,
  "convexity": 75.29958076997515,
  "dv01": 0.0761050931425701,
  "pv01": 0.0761050931425701,
  "assumptions": {
    "conventionsVersion": "0.0.1",
    "dayCount": "30/360",
    "compounding": "actuarial",
    "frequency": 2,
    "settlementDate": "2026-01-01",
    "businessDayConvention": "modifiedFollowing"
  },
  "diagnostics": {
    "method": "closed-form",
    "warnings": []
  }
}
Reproduce this entire calculator
Full result object

Both examples use the inputs of the last successful calculation. Displayed metrics are rounded; copied programs keep exact values. Every copy on this page is type-checked and executed against the packed package in CI.

Ask your AI agent

With the TotalFinance MCP server connected, your agent runs this calculation with the totalfinance_fixed_income_bond_analytics tool (on by default). The prompt below uses your current inputs.

Prompt

Use the TotalFinance MCP tool totalfinance_fixed_income_bond_analytics for a 10-year bond with a 4.5% annual coupon paid semiannual, priced at a 5% yield. Report the price, durations and convexity, and what a 1% yield rise would do to the price.

Connect Claude, Cursor, VS Code, Codex or ChatGPT

What this calculates

bonds.fixedRate builds a bond with its full payment schedule. yieldMetrics prices it at a yield and returns the clean and dirty price, accrued interest, Macaulay and modified duration, convexity and DV01 (the price change for a one-basis-point rise in yield, per 100 of face value). The applied day count, compounding and business-day convention are echoed in the assumptions.

Reading the charts

The price–yield curve bends upward. That curvature is convexity: when yields fall, price rises more than it falls when yields rise by the same amount. The cash-flow chart shows the coupons and the final repayment of face value.

Going further

Curves, key-rate durations, floating and inflation-linked notes, swaps, caps and swaptions live in the Fixed income domain.

Edit this page on GitHub ↗Every code block on this site is executed in CI against the library.