Financial Derivatives Toolbox | ![]() ![]() |
Calculating Prices and Sensitivities
The function hjmsens
computes the delta, gamma, and vega sensitivities of instruments using an interest rate tree created with hjmtree
. It also optionally returns the calculated price for each instrument. hjmsens
requires the same two input arguments used by hjmprice
, namely HJMTree
and HJMInstSet
.
hjmsens
calculates 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.
The calling syntax for the function is
Use the previous example data to calculate the price of instruments.
load deriv.mat [Delta, Gamma, Vega, Price] = hjmsens(HJMTree, HJMInstSet); Warning: Not all cash flows are aligned with the tree. Result will be approximated.
Note The warning appears because some of the cash flows for the second bond do not fall exactly on a tree node. This situation was discussed in HJM Pricing Options Structure. |
You can conveniently examine the sensitivities and the prices by arranging them into a single matrix.
All = [Delta, Gamma, Vega, Price] All = -272.65 1029.90 0.00 98.72 -347.43 1622.69 -0.04 97.53 -8.08 643.40 34.07 0.05 -272.65 1029.90 0.00 98.72 -1.04 3.31 0 100.55 294.97 6852.56 93.69 6.28 -47.16 8459.99 93.69 0.05 -282.05 1059.68 0.00 3.69
As with the prices, each row of the sensitivity vectors corresponds to the similarly indexed instrument in HJMInstSet
. 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.76 10.43 0.00 98.72 -3.56 16.64 -0.00 97.53 -166.18 13235.59 700.96 0.05 -2.76 10.43 0.00 98.72 -0.01 0.03 0 100.55 46.95 1090.63 14.91 6.28 -969.85 173969.77 1926.72 0.05 -76.39 287.00 0.00 3.690
![]() | HJM Pricing Options Structure | Black-Derman-Toy Model (BDT) | ![]() |