The Price of One Basis Point
DV01 is the change in a bond's value for one basis point of its yield, modified duration times value times 0.0001; repricing up and down confirms it.
The question
When the yield of a bond rises, its price falls. By how much for the smallest move that traders quote, one basis point, which is 0.01% of yield? The answer is called DV01, the value of 01: the change in the bond's value for one basis point of its own yield. It is the number a hedge is built on in the next lessons, so this lesson makes it concrete. The bond, its yield and its face value are made-up inputs of a model.
Work it by hand
DV01 is modified duration times the value of the position times 0.0001. Take a bond that pays only at the end: 1,000 of face, repaid in 3 years, with a yield of 10% a year. Its value is 1,000 divided by 1.1 to the power 3, which is 751.31. Its modified duration is the 3 years divided by 1.1, which is 2.7273.
DV01 is 751.31 times 2.7273 times 0.0001, which is 0.2049: one basis point more of yield takes 0.2049 from the value, to four decimal places. Repricing at a yield of 10.01% gives a value 0.20487 lower, which is 0.2049 to four decimal places. The same rule gives the DV01 of any bond once its modified duration is known; see Modified Duration.
Run it
The program prices a bond of 1,000,000 face, a 5% coupon once a year and 10 years, at a yield of 5%. Prices in lmfinance are per 100 of face, so lines 5 to 7 multiply by face / 100.0; risk.bond_dv01_yield on line 3 already answers in currency for the whole face.

Watch the steps (recorded video)
market.set_date("2025-01-02");
let bond = instrument.bond(face, coupon, float(years), 1);
let dv = risk.bond_dv01_yield(bond, rate);
let mod = pricing.bond_duration(bond, rate);
let now = pricing.bond_price_from_yield(bond, rate) * face / 100.0;
let up = pricing.bond_price_from_yield(bond, rate + 0.0001) * face / 100.0;
let down = pricing.bond_price_from_yield(bond, rate - 0.0001) * face / 100.0;
lmcode_return_put("dv01", lmf.money(dv));
lmcode_return_put("duration", str(lmf.round(mod, 4)));
lmcode_return_put("up", lmf.money(up - now));
lmcode_return_put("down", lmf.money(down - now));
lmcode_return_put("mean", lmf.money((down - up) / 2.0));
let answer = int(math_round(lmf.round(dv, 2) * 100.0));
{
"answer": 77217,
"dv01": "772.17",
"duration": "7.7217",
"up": "-771.80",
"down": "772.55",
"mean": "772.17"
}Line 3 asks the engine for the DV01 and line 4 for the modified duration. Lines 6 and 7 reprice one basis point up and down. DV01 is 772.17 and the duration 7.7217. One basis point up changes the value by -771.80, and one down by 772.55; the mean of the two sizes is 772.17. The answer, on line 13, is the DV01 in whole cents, 77217: whole cents because binary floats are never exact to the last digit.
You can change all four inputs. A yield of -1 or lower stops line 3 with "risk.bond_dv01_yield: yield must be above -100% per coupon period (above -100% a year for 1 period a year), got -1". A face value of 0 or below stops it with "face value must be positive", and years of 0 or 101 with "bond maturity must be between 0 and 100 years". A coupon of 0 or below does not stop: a zero coupon gives 584.68.
A face of 10^18 or more makes the DV01 in cents too large to return, and the run stops, without a line, with "lmcode return: invalid JSON value at /answer: unsafe_integer"; 10^17 still runs. A yield above -100% but within one basis point of it stops line 7 with "pricing.bond_price_from_yield: yield must be above -100% per coupon period (above -100% a year for 1 period a year), got -1.00009" (for a yield of -0.99999).
Your turn
The program below should return the loss that DV01 predicts when a bond's yield rises by a number of basis points. Several candidate programs are offered. Read them, run them on bonds of your own, and decide which of them is right for every bond. Check runs each candidate on the bond shown and on five others.

market.set_date("2025-01-02");
let bond = instrument.bond(face, coupon, float(years), 1);
let value = pricing.bond_price_from_yield(bond, rate) * face / 100.0;
let dv = pricing.bond_macaulay_duration(bond, rate) * value * 0.0001;
let loss = lmf.round(dv * float(bp), 2);
lmcode_return_put("per_bp", lmf.money(dv));
let answer = int(math_round(loss * 100.0));
{
"answer": 1256905,
"per_bp": "502.76"
}Return, in whole cents, the loss in value that the DV01 of the bond predicts when its yield rises by bp basis points: DV01 times bp. The bond pays its coupon once a year and is valued at its yield rate. DV01 is the change in the bond's value for a change of one basis point in its own yield, in currency for the whole face value: the slope of the price at today's yield, not the average of a repricing one basis point up and down. Check runs your program on this bond and on five others.
Read the result carefully
DV01 is the slope of the price at today's yield, exact only for a vanishing move. For the bond of the demo and a rise of 25 basis points it predicts a loss of 19,304.34, while repricing at the higher yield gives 19,072.10: the gap is the curvature of the price, the subject of lesson 5. The estimate is also symmetric, and the exact change is not.
The older call risk.bond_dv01 bumps the continuously compounded zero rates of a curve and is another number for the same bond: 811.02 against 772.17 here. This book uses risk.bond_dv01_yield only and never mixes the two. The bond pays for certain, the yield is an input, and DV01 says how sensitive the value is, not how far a yield will move.
Recap
- DV01 is the change in value for one basis point of the bond's own yield: modified duration times value times 0.0001.
- A 3-year zero bond of 1,000 at 10% has a DV01 of 0.2049.
- Repricing one basis point up and down gives almost the same size: 771.80 and 772.55 against 772.17.
- DV01 is a model's sensitivity at one yield, for the whole face.