# hjmsens

Instrument prices and sensitivities from Heath-Jarrow-Morton interest-rate tree

## Syntax

``[Delta,Gamma,Vega,Price] = hjmsens(HJMTree,InstSet)``
``[Delta,Gamma,Vega,Price] = hjmsens(___,Options)``

## Description

example

````[Delta,Gamma,Vega,Price] = hjmsens(HJMTree,InstSet)` computes instrument sensitivities and prices for instruments using an interest-rate tree created with the `hjmtree` function. All sensitivities are returned as dollar sensitivities. To find the per-dollar sensitivities, divide by the respective instrument price.`hjmsens` handles instrument types: `'Bond'`, `'CashFlow'`, `'OptBond'`, `'OptEmBond'`, `'OptEmBond'`, `'OptFloat'`, `'OptEmFloat'`, `'Fixed'`, `'Float'`, `'Cap'`, `'Floor'`, `'RangeFloat'`, `'Swap'`. See `instadd` for information on instrument types.```

example

````[Delta,Gamma,Vega,Price] = hjmsens(___,Options)` adds an optional input argument for `Options`.```

## Examples

collapse all

Load the tree and instruments from the `deriv.mat` data file. Compute `Delta` and `Gamma` for the cap and bond instruments contained in the instrument set.

```load deriv.mat; HJMSubSet = instselect(HJMInstSet,'Type', {'Fixed', 'Cap'}); instdisp(HJMSubSet)```
```Index Type CouponRate Settle Maturity FixedReset Basis Principal Name Quantity 1 Fixed 0.04 01-Jan-2000 01-Jan-2003 1 NaN NaN 4% Fixed 80 Index Type Strike Settle Maturity CapReset Basis Principal Name Quantity 2 Cap 0.03 01-Jan-2000 01-Jan-2004 1 NaN NaN 3% Cap 30 ```

Compute the `Delta` and `Gamma` for the cap and bond instruments.

`[Delta, Gamma] = hjmsens(HJMTree, HJMSubSet)`
```Delta = 2×1 -272.6462 294.9700 ```
```Gamma = 2×1 103 × 1.0299 6.8526 ```

## Input Arguments

collapse all

Interest-rate tree structure, specified by using `hjmtree`.

Data Types: `struct`

Instrument variable containing a collection of `NINST` instruments, specified using `instadd`. Instruments are categorized by type; each type can have different data fields. The stored data field is a row vector or character vector for each instrument.

Data Types: `struct`

Derivatives pricing options structure, created using `derivset`.

Data Types: `struct`

## Output Arguments

collapse all

Rate of change of instruments prices with respect to changes in the interest rate, returned as a `NINST`-by-`1` vector of deltas. `Delta` is computed by finite differences in calls to `hjmtree`.

Note

`Delta` is calculated based on yield shifts of 100 basis points.

Rate of change of instruments deltas with respect to changes in the interest rate, returned as a `NINST`-by-`1` vector of gammas. `Gamma` is computed by finite differences in calls to `hjmtree`.

Note

`Gamma` is calculated based on yield shifts of 100 basis points.

Rate of change of instruments prices with respect to changes in the volatility, returned as a `NINST`-by-`1` vector of vegas. Volatility is $\sigma \left(t,T\right)$ of the interest rate. `Vega` is computed by finite differences in calls to `hjmtree`. For information on the volatility process, see `hjmvolspec`.

Note

`Vega` is calculated based on 1% shift in the volatility process.

Price of each instrument, returned as a `NINST`-by-`1` vector. The prices are computed by backward dynamic programming on the interest-rate tree. If an instrument cannot be priced, a `NaN` is returned in that entry.

## Version History

Introduced before R2006a