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 InstSet
.
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
[Delta, Gamma, Vega, Price] = hjmsens(HJMTree, HJMInstSet)
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" on page 1-56. |
The sensitivities and the prices can be examined conveniently by arranging them into a single matrix.
All = [Delta, Gamma, Vega, Price] All = 1.0e+003 * -0.2997 1.1603 -0.0000 0.1058 -0.3958 1.9012 -0.0003 0.1077 -0.0818 0.5566 0.0610 0.0073 -0.2997 1.1603 -0.0000 0.1058 -0.0011 0.0037 0 0.1006 0.1085 -0.6975 0.1665 0.0154 -0.1741 0.9569 0.1615 0.0154 -0.2986 1.1567 -0.0000 0.0052
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.8337 10.9706 -0.0000 105.7678 -3.6759 17.6566 -0.0026 107.6773 -11.1729 76.0234 8.3312 7.3217 -2.8337 10.9706 -0.0000 105.7678 -0.0112 0.0364 0 100.5768 7.0273 -45.1870 10.7873 15.4367 -11.3117 62.1593 10.4911 15.3938 -57.5215 222.8243 -0.0000 5.1910
![]() | Pricing and Sensitivity from HJM | Hedging | ![]() |