How to calculate the modified duration of T-bill (discount instrument) and europeans bills (zero coupon instrument). I couldn't find how Bloomberg is calculating those values on YA
1 Answer
{LPHP YA:7:1 805703 } is the direct link to the help page (just copy paste into IB
).
Duration itself (for zero coupon bonds) is just the maturity itself, scaled by price.
Modified duration is the same, but divided by (1+y). DV01 is the dollar value change in market value given a one basis point change in interest rates. It is calculated as price * Mod duration/100. Looking at a specific example, say B 0 08/29/24 Govt
, YAS looks like this:
Replicating this in Python code:
from datetime import datetime
import pandas as pd
today = datetime(2024,5,29)
maturity = datetime(2024,8,29)
daycount = 360
price = 98.6722847
discount = 5.2525
days = maturity - today
maturity_yrs = days.days/daycount
duration = round(maturity_yrs/price*100,3)
modified_d = round(duration / (1+discount/100),3)
DV01 = round(modified_d*price,2)
pd.DataFrame({"Duration": [duration], "Modified Duration" : [modified_d], "DV01": DV01})