ForHosting KIT · Finance & money

Effective duration calculator

A bond priced at 100 that would rise to 101.5 if yields fell 0.25 points and drop to 98.6 if they rose 0.25 has an effective duration of 5.8. It works for callable bonds and mortgage-backed securities too. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Price
100
Price down
101.5
Price up
98.6
Yield shift
0.25
You get
Yield shift decimal
0.0025
Effective duration
5.8

Effective duration measures how much a bond's price is expected to move when benchmark yields shift, using observed or model prices at those shifted yields rather than a closed-form coupon schedule. That is the right sensitivity for callable bonds, mortgage-backed securities, and any instrument whose cash flows change when rates move. This effective duration calculator accepts the current price, the price after a downward yield shock, the price after an upward yield shock, and the size of that shock in percent, then returns duration from the standard central-difference formula.

What effective duration measures and how the central-difference formula works

Modified duration and Macaulay duration assume that every remaining coupon and the redeemed face value are known in advance, so a small change in yield only re-discounts the same cash-flow strip. Effective duration drops that assumption.

It asks a pricing model, or the market, for three prices: V0 at the current yield curve, V− after a parallel downward shock of size Δy, and V+ after an equal upward shock, then applies the central finite difference Deff equals (V− minus V+) divided by two times V0 times the absolute value of Δy. The result is the approximate percentage price change for a one percentage-point move in yield, with the usual sign convention that a positive duration means the price falls when yields rise.

Because the shocked prices already embed whatever happens to option exercise, prepayments, or sinking-fund behaviour, the metric stays defined for callable corporates, mortgage-backed pass-throughs, and other path-dependent structures where modified duration would be the wrong number. The absolute value of the yield shock sits in the denominator so a signed input of minus twenty-five basis points and plus twenty-five basis points produce the same duration; only a true zero shock is undefined, because there is then no interval over which to measure the slope.

Mortgage-backed and prepayment-sensitive pools

Measure rate sensitivity from model prices that already embed prepayment, rather than Macaulay duration on an assumed scheduled cash-flow path.

How is effective duration different from modified duration?

Modified duration re-discounts a fixed coupon schedule. Effective duration uses prices that already include option exercise, prepayments, or other cash-flow changes when yields move, so it is the correct first-order sensitivity for bonds with embedded options.

How is effective duration calculated?

Subtract the price after the upward yield shock from the price after the downward shock, then divide by two times the current price times the size of the shock as a decimal. That central difference measures the slope of price against yield.

How do I read the result?

It is the approximate percentage change in price for a one percentage-point move in yield. A positive duration means the price falls when yields rise, so a duration of 5.8 suggests roughly a 5.8% drop for a one-point rise.

How do I enter the yield shift?

In percentage points: 0.25 means 25 basis points and 1 means one full point. The calculator uses the size of the shift, so plus or minus 0.25 gives the same duration; only a zero shift is rejected.

Where do the shocked prices come from?

From a pricing model or from the market. You supply all three prices; the calculator does not reprice the bond from its coupons, so the shocked prices can already include calls, prepayments or sinking-fund effects.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/fin/effective-duration

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/fin/effective-duration \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"price":100,"price_down":101.5,"price_up":98.6,"yield_shift":0.25}'
{
  "price": 100,
  "price_down": 101.5,
  "price_up": 98.6,
  "yield_shift": 0.25
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "fin.effective_duration",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

A zero yield shift is rejected with invalid_input because the denominator would be zero.

What effective duration measures and how the central-difference formula works

This endpoint does not reprice the bond from coupons: you already have the three prices, and the calculator turns them into the sensitivity that fixed-income desks, CFA items, and education widgets all call effective duration.

Input contract, response shape, and error behaviour

A zero shock is the contract error this product exists to catch: there is no well-defined slope when the two shocked prices sit on top of the same yield. POST a JSON body with four required finite numbers: price, the current dirty or model price V0, which must be greater than zero (aliases current_price, v0, and p0); price_down, the price after a downward yield shock of the same size (aliases price_minus, v_minus, and p_down); price_up, the price after an upward yield shock (aliases price_plus, v_plus, and p_up); and yield_shift, the parallel shock in percent, so 0.25 means twenty-five basis points and 1 means one full percentage point (aliases yield_shift_percent, delta_y, dy, and yield_change). Optional decimals is an integer from zero through twelve (default six) controlling half-up rounding on yield_shift_decimal and effective_duration. On success the body echoes the three prices and the yield_shift you sent, adds yield_shift_decimal (the same shock as a decimal fraction, keeping the sign of the input), effective_duration in years of rate sensitivity, and a formula string restating the central-difference identity. Worked example: price one hundred, price_down one hundred one point five, price_up ninety-eight point six, yield_shift 0.25 percent produces Δy of 0.0025 and effective duration of 5.8, because 2.9 divided by 0.5 is 5.8. Missing fields, non-finite values, a non-positive price, price_down, or price_up, or a yield_shift of exactly zero fail with invalid_input naming the field and are not billed.

Where an effective duration calculator earns its keep

Content sites can contrast the 5.8 figure from a plain option-free example with a much smaller duration from a tight-call price path so readers see why embedded options shorten effective duration. Integrators drop the same contract into n8n flows, edge workers, or classroom LMS plugins. Failed validation does not consume balance. Asset managers who run an option-adjusted spread engine already have V− and V+ on the grid; wiring those three marks into a tiny parse endpoint avoids re-implementing the identity in every notebook and keeps goldens pinned when the pricing library changes. Treasury and risk teams use effective duration to size hedges on callable agencies and mortgage-backed pools, where modified duration from a static coupon strip would overstate how much price can rise when yields fall into the call or prepayment region. Keep the three prices strictly positive, never send a zero yield_shift, pin the rounded effective_duration in tests, and you get a reproducible rate-sensitivity figure without standing up a full fixed-income library of your own.

Callable and putable bond hedges

Turn option-adjusted prices at plus and minus a yield shock into effective duration so hedges reflect the call or put, not a static coupon strip.

CFA prep and classroom checks

Give learners a deterministic oracle for the (V− − V+) / (2 V0 Δy) identity, including a billed-free invalid_input when the yield shock is zero.

How is effective duration calculated from shifted-yield prices?

Send the current price V0, the price after a downward yield shock V−, the price after an upward shock V+, and yield_shift in percent. The API returns Deff = (V− − V+) / (2 × V0 × |Δy|), with Δy equal to yield_shift divided by one hundred.

What happens if the yield shift is zero?

The task fails with invalid_input. A zero shock makes the central-difference denominator zero, so effective duration is undefined and the request is not billed.

What unit is yield_shift in?

Percent. 0.25 means a 0.25 percent (25 basis point) parallel shock; 1 means one percentage point. The response also echoes yield_shift_decimal, the same shock as a decimal fraction.

What does the effective duration calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →