## Computing Instrument Sensitivities

Sensitivities can be reported either as dollar price changes or percentage price changes. The delta, gamma, and vega sensitivities that the toolbox computes are dollar sensitivities.

The functions hjmsens and bdtsens compute the delta, gamma, and vega sensitivities of instruments using an interest-rate tree. They also optionally return the calculated price for each instrument. The sensitivity functions require the same two input arguments used by the pricing functions (HJMTree and HJMInstSet for HJM; BDTTree and BDTInstSet for BDT).

Sensitivity functions calculate the dollar value of delta and gamma by shifting the observed forward yield curve by 100 basis points in each direction, and the dollar value of vega by shifting the volatility process by 1%. To obtain the per-dollar value of the sensitivities, divide the dollar sensitivity by the price of the corresponding instrument.

### HJM Sensitivities Example

The calling syntax for the function is:

[Delta, Gamma, Vega, Price] = hjmsens(HJMTree, HJMInstSet)

Use the previous example data to calculate the price and sensitivity values for the cap and floor instruments.

HJMSubSet = instselect(HJMInstSet,'Type', {'Floor','Cap'});

% Display instrument set
instdisp(HJMSubSet)
Index Type Strike Settle         Maturity       CapReset Basis Principal Name   Quantity
1     Cap  0.03   01-Jan-2000    01-Jan-2004    1        NaN   NaN       3% Cap 30

Index Type  Strike Settle         Maturity       FloorReset Basis Principal Name     Quantity
2     Floor 0.03   01-Jan-2000    01-Jan-2004    1          NaN   NaN       3% Floor 40

Compute price and sensitivity values for the cap and floor instruments.

[Delta, Gamma, Vega, Price] = hjmsens(HJMTree, HJMSubSet)
Delta =

294.9700
-47.1629

Gamma =

1.0e+03 *

6.8526
8.4600

Vega =

93.6946
93.6946

Price =

6.2831
0.0486

### BDT Sensitivities Example

The calling syntax for the function is:

[Delta, Gamma, Vega, Price] = bdtsens(BDTTree, BDTInstSet);

Arrange the sensitivities and prices into a single matrix.

All = [Delta, Gamma, Vega, Price]
All =

-232.67       803.71      -0.00       95.50
-281.05      1181.93      -0.01       93.91
-50.54       246.02       5.31        1.77
-232.67       803.71          0       95.50
0.84         2.45          0      100.49
78.38       748.98      13.54        1.49
-4.36       382.06       2.50        0.02
-253.23       863.81          0        7.42

To view the per-dollar sensitivities, divide each dollar sensitivity by the corresponding instrument price.

All = [Delta ./ Price, Gamma ./ Price, Vega ./ Price, Price]
All =

-2.44         8.42      -0.00       95.50
-2.99        12.59      -0.00       93.91
-28.63       139.34       3.01        1.77
-2.44         8.42          0       95.50
0.01         0.02          0      100.49
52.73       503.92       9.11        1.49
-177.89     15577.42     101.87        0.02
-34.12       116.38          0        7.42