*Macaulay* and *modified
duration* measure the sensitivity of a bond's price to changes
in the level of interest rates. *Convexity* measures
the change in duration for small shifts in the yield curve, and thus
measures the second-order price sensitivity of a bond. Both measures
can gauge the vulnerability of a bond portfolio's value to changes
in the level of interest rates.

Alternatively, analysts can use duration and convexity to construct a bond portfolio that is partly hedged against small shifts in the term structure. If you combine bonds in a portfolio whose duration is zero, the portfolio is insulated, to some extent, against interest rate changes. If the portfolio convexity is also zero, this insulation is even better. However, since hedging costs money or reduces expected return, you must know how much protection results from hedging duration alone compared to hedging both duration and convexity.

This example demonstrates a way to analyze the relative importance of duration and convexity for a bond portfolio using some of the SIA-compliant bond functions in Financial Toolbox™ software. Using duration, it constructs a first-order approximation of the change in portfolio price to a level shift in interest rates. Then, using convexity, it calculates a second-order approximation. Finally, it compares the two approximations with the true price change resulting from a change in the yield curve.

Define three bonds using values for the settlement date, maturity
date, face value, and coupon rate. For simplicity, accept default
values for the coupon payment periodicity (semiannual), end-of-month
payment rule (rule in effect), and day-count basis (actual/actual).
Also, synchronize the coupon payment structure to the maturity date
(no odd first or last coupon dates). Any inputs for which defaults
are accepted are set to empty matrices (`[]`

) as
placeholders where appropriate.

Settle = '19-Aug-1999'; Maturity = ['17-Jun-2010'; '09-Jun-2015'; '14-May-2025']; Face = [100; 100; 1000]; CouponRate = [0.07; 0.06; 0.045];

Also, specify the yield curve information.

Yields = [0.05; 0.06; 0.065];

Use Financial Toolbox functions to calculate the price, modified duration in years, and convexity in years of each bond.

The true price is quoted (clean) price plus accrued interest.

[CleanPrice, AccruedInterest] = bndprice(Yields, CouponRate,... Settle, Maturity, 2, 0, [], [], [], [], [], Face); Durations = bnddury(Yields, CouponRate, Settle, Maturity, 2, 0,... [], [], [], [], [], Face); Convexities = bndconvy(Yields, CouponRate, Settle, Maturity, 2, 0,... [], [], [], [], [], Face); Prices = CleanPrice + AccruedInterest;

Choose a hypothetical amount by which to shift the yield curve (here, 0.2 percentage point or 20 basis points).

dY = 0.002;

Weight the three bonds equally, and calculate the actual quantity of each bond in the portfolio, which has a total value of $100,000.

PortfolioPrice = 100000; PortfolioWeights = ones(3,1)/3; PortfolioAmounts = PortfolioPrice * PortfolioWeights ./ Prices;

Calculate the modified duration and convexity of the portfolio. The portfolio duration or convexity is a weighted average of the durations or convexities of the individual bonds. Calculate the first- and second-order approximations of the percent price change as a function of the change in the level of interest rates.

```
PortfolioDuration = PortfolioWeights' * Durations;
PortfolioConvexity = PortfolioWeights' * Convexities;
PercentApprox1 = -PortfolioDuration * dY * 100;
PercentApprox2 = PercentApprox1 + ...
PortfolioConvexity*dY^2*100/2.0;
```

Estimate the new portfolio price using the two estimates for the percent price change.

PriceApprox1 = PortfolioPrice + ... PercentApprox1 * PortfolioPrice/100; PriceApprox2 = PortfolioPrice + ... PercentApprox2 * PortfolioPrice/100;

Calculate the true new portfolio price by shifting the yield curve.

[CleanPrice, AccruedInterest] = bndprice(Yields + dY,... CouponRate, Settle, Maturity, 2, 0, [], [], [], [], [],... Face); NewPrice = PortfolioAmounts' * (CleanPrice + AccruedInterest);

Compare the results. The analysis results are as follows:

The original portfolio price was $100,000.

The yield curve shifted up by 0.2 percentage point or 20 basis points.

The portfolio duration and convexity are 10.3181 and 157.6346, respectively. These are needed for Bond Portfolio for Hedging Duration and Convexity.

The first-order approximation, based on modified duration, predicts the new portfolio price (

`PriceApprox1`

), which is $97,936.37.The second-order approximation, based on duration and convexity, predicts the new portfolio price (

`PriceApprox2`

), which is $97,967.90.The true new portfolio price (

`NewPrice`

) for this yield curve shift is $97,967.51.The estimate using duration and convexity is good (at least for this fairly small shift in the yield curve), but only slightly better than the estimate using duration alone. The importance of convexity increases as the magnitude of the yield curve shift increases. Try a larger shift (

`dY`

) to see this effect.

The approximation formulas in this example consider only parallel
shifts in the term structure, because both formulas are functions
of `dY`

, the change in yield. The formulas are not
well-defined unless each yield changes by the same amount. In actual
financial markets, changes in yield curve level typically explain
a substantial portion of bond price movements. However, other changes
in the yield curve, such as slope, may also be important and are not
captured here. Also, both formulas give local approximations whose
accuracy deteriorates as `dY`

increases in size.
You can demonstrate this by running the program with larger values
of `dY`

.

`blsdelta`

| `blsgamma`

| `blsprice`

| `blsvega`

| `bndconvy`

| `bnddury`

| `bndkrdur`

| `bndprice`

| `zbtprice`

| `zero2disc`

| `zero2fwd`

- Pricing and Analyzing Equity Derivatives
- Greek-Neutral Portfolios of European Stock Options
- Bond Portfolio for Hedging Duration and Convexity
- Bond Prices and Yield Curve Parallel Shifts
- Bond Prices and Yield Curve Nonparallel Shifts
- Term Structure Analysis and Interest-Rate Swaps
- Plotting Sensitivities of an Option
- Plotting Sensitivities of a Portfolio of Options