General Statistics
Collect the bond statistics for a given bond which includes the following fields:
- Par Value: The face value of the bond.
- Coupon Rate: The annual coupon rate (in decimal).
- Years to Maturity: The number of years until the bond matures.
- Yield to Maturity: The yield to maturity of the bond (in decimal).
- Frequency: The number of coupon payments per year.
- Present Value: The present value of the bond.
- Current Yield: The annual coupon payment divided by the bond price.
- Effective Yield: The annualised yield that accounts for the compounding of the coupon payments made within the year.
- Macaulay’s Duration: The weighted average time to receive the bond’s cash flows.
- Modified Duration: The Macaulay’s duration divided by 1 plus the per-period yield (yield to maturity divided by the frequency).
- Effective Duration: The percentage price change per unit change in yield, obtained by repricing the bond symmetrically 1% above and 1% below the current yield.
- Dollar Duration: The modified duration multiplied by the bond price, divided by 100.
- DV01: The currency change in the bond’s price, per par value of face, for a one basis point (0.01%) change in the yield to maturity.
- Convexity: The second derivative of the bond price with respect to the yield to maturity.
These statistics can be used to evaluate the bond’s performance as opposed to other bonds or to estimate the bond’s sensitivity to changes in interest rates to be able to apply a hedging strategy.
Also known as: bond data, fixed income statistics.
General Statistics in Python
collect_bond_statistics is part of the Fixed Income module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call collect_bond_statistics as shown below.
from financetoolkit import FixedIncome
fixedincome = FixedIncome()
# This is one example and below a collection of different bonds is shown with different characteristics
fixedincome.collect_bond_statistics(
par_value=100,
coupon_rate=0.05,
years_to_maturity=5,
yield_to_maturity=0.08,
frequency=1,
)
Which returns:
| Bond 1 | Bond 2 | Bond 3 | Bond 4 | Bond 5 | Bond 6 | |
|---|---|---|---|---|---|---|
| Par Value | 100 | 250 | 50 | 1000 | 85 | 320 |
| Coupon Rate | 0.05 | 0.02 | 0.075 | 0 | 0.15 | 0.015 |
| Years to Maturity | 5 | 10 | 2 | 10 | 3 | 1 |
| Yield to Maturity | 0.08 | 0.021 | 0.03 | 0 | 0.16 | 0.04 |
| Frequency | 1 | 1 | 4 | 1 | 2 | 12 |
| Present Value | 88.0219 | 247.766 | 54.3518 | 1000 | 83.0353 | 312.171 |
| Current Yield | 0.0568 | 0.0202 | 0.069 | 0 | 0.1535 | 0.0154 |
| Effective Yield | 0.05 | 0.02 | 0.0771 | 0 | 0.1556 | 0.0151 |
| Macaulay’s Duration | 4.5116 | 9.1576 | 1.8819 | 10 | 2.5167 | 0.9931 |
| Modified Duration | 4.1774 | 8.9693 | 1.8679 | 10 | 2.3302 | 0.9898 |
| Effective Duration | 4.1798 | 8.9874 | 1.8681 | 10.022 | 2.3307 | 0.9898 |
| Dollar Duration | 3.677 | 22.2228 | 1.0152 | 100 | 1.9349 | 3.0897 |
| DV01 | 0.0368 | 0.2222 | 0.0102 | 1 | 0.0193 | 0.0309 |
| Convexity | 22.4017 | 93.7509 | 4.0849 | 110 | 7.0923 | 1.0662 |
Note how the effective duration sits just above the modified duration for every bond: the two measure the same sensitivity, and their small difference is exactly the convexity picked up by repricing over a 100 basis point shift rather than differentiating at a point.
Parameters
collect_bond_statistics accepts the following parameters:
- par_value (float): The face value of the bond. Defaults to 100.
- coupon_rate (float): The annual coupon rate (in decimal). Defaults to 0.05.
- years_to_maturity (int): The number of years until the bond matures. Defaults to 5.
- yield_to_maturity (float): The yield to maturity of the bond (in decimal). Defaults to 0.08.
- frequency (int): The number of coupon payments per year. Defaults to 1.
- show_input_info (bool, optional): Whether to display input information. Defaults to True.