# cirsens

Instrument sensitivities and prices from Cox-Ingersoll-Ross interest-rate model

## Description

example

[Delta,Gamma,Vega,Price] = cirsens(CIRTree,InstSet) computes dollar sensitivities and prices for instruments using a Cox-Ingersoll-Ross (CIR) interest rate tree created with cirtree. The CIR tree uses a CIR++ model with the Nawalka-Beliaeva (NB) approach.

Note

All sensitivities are returned as dollar sensitivities. To find the per-dollar sensitivities, divide by the respective instrument price.

cirsens handles the following instrument type values: 'Bond', 'CashFlow','OptBond', 'Fixed', 'Float', 'Cap', 'Floor', 'Swap','Swaption', 'RangeFloat', 'OptFloat', 'OptEmFloat'.

## Examples

collapse all

Define and set up two bond instruments. Compute Delta and Gamma for the bond instruments contained in the instrument set.

CouponRate= [0.035;0.04];
Settle= 'Jan-1-2017';
Maturity = 'Jan-1-2019';
Period = 1;
InstSet = instbond(CouponRate, Settle, Maturity, Period)
InstSet = struct with fields:
FinObj: 'Instruments'
IndexTable: [1x1 struct]
Type: {'Bond'}
FieldName: {{11x1 cell}}
FieldClass: {{11x1 cell}}
FieldData: {{11x1 cell}}

instdisp(InstSet)
Index Type CouponRate Settle         Maturity       Period Basis EndMonthRule IssueDate FirstCouponDate LastCouponDate StartDate Face
1     Bond 0.035      01-Jan-2017    01-Jan-2019    1      0     1            NaN       NaN             NaN            NaN       100
2     Bond 0.04       01-Jan-2017    01-Jan-2019    1      0     1            NaN       NaN             NaN            NaN       100

Create a RateSpec using the intenvset function.

Rates = [0.035; 0.042147; 0.047345; 0.052707];
Dates = {'Jan-1-2017'; 'Jan-1-2018'; 'Jan-1-2019'; 'Jan-1-2020'; 'Jan-1-2021'};
ValuationDate = 'Jan-1-2017';
EndDates = Dates(2:end)';
Compounding = 1;
RateSpec = intenvset('ValuationDate', ValuationDate, 'StartDates', ValuationDate, 'EndDates',EndDates,'Rates', Rates, 'Compounding', Compounding);

Create a CIR tree.

NumPeriods = length(EndDates);
Alpha = 0.03;
Theta = 0.02;
Sigma = 0.1;
Settle = '01-Jan-2017';
Maturity = '01-Jan-2019';
CIRTimeSpec = cirtimespec(Settle, Maturity, NumPeriods);
CIRVolSpec = cirvolspec(Sigma, Alpha, Theta);

CIRT = cirtree(CIRVolSpec, RateSpec, CIRTimeSpec)
CIRT = struct with fields:
FinObj: 'CIRFwdTree'
VolSpec: [1x1 struct]
TimeSpec: [1x1 struct]
RateSpec: [1x1 struct]
tObs: [0 0.5000 1 1.5000]
dObs: [736696 736878 737061 737243]
FwdTree: {1x4 cell}
Connect: {[3x1 double]  [3x3 double]  [3x5 double]}
Probs: {[3x1 double]  [3x3 double]  [3x5 double]}

Calculate the Delta and Gamma sensitivities for the two bonds.

[Delta, Gamma] = cirsens(CIRT,InstSet)
Delta = 2×1

-186.1885
-187.5390

Gamma = 2×1

532.8675
536.3132

## Input Arguments

collapse all

Interest-rate tree structure, specified by using cirtree.

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

## 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 cirtree.

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 cirtree.

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 (t,T) of the interest rate. Vega is computed by finite differences in calls to cirtree. For information on the volatility process, see cirvolspec.

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.

## References

[1] Cox, J., Ingersoll, J.,and S. Ross. "A Theory of the Term Structure of Interest Rates." Econometrica. Vol. 53, 1985.

[2] Brigo, D. and F. Mercurio. Interest Rate Models - Theory and Practice. Springer Finance, 2006.

[3] Hirsa, A. Computational Methods in Finance. CRC Press, 2012.

[4] Nawalka, S., Soto, G., and N. Beliaeva. Dynamic Term Structure Modeling. Wiley, 2007.

[5] Nelson, D. and K. Ramaswamy. "Simple Binomial Processes as Diffusion Approximations in Financial Models." The Review of Financial Studies. Vol 3. 1990, pp. 393–430.