| Contents | Index |
| On this page… |
|---|
For purposes of illustration, this section relies on the HJM and BDT models. The HW and BK functions that perform price and sensitivity computations are not explicitly shown here. Functions that use the HW and BK models operate similarly to the BDT model.
The portfolio pricing functions hjmprice and bdtprice calculate the price of any set of supported instruments, based on an interest-rate tree. The functions are capable of pricing these instrument types:
Bonds
Bond options
Bond with embedded options
Arbitrary cash flows
Fixed-rate notes
Floating-rate notes
Caps
Floors
Range Notes
Swaps
Swaptions
For example, the syntax for calling hjmprice is:
[Price, PriceTree] = hjmprice(HJMTree, InstSet, Options)
Similarly, the calling syntax for bdtprice is:
[Price, PriceTree] = bdtprice(BDTTree, InstSet, Options)
Each function requires two input arguments: the interest-rate tree and the set of instruments, InstSet. An optional argument Options further controls the pricing and the output displayed. (See Derivatives Pricing Options for information about the Options argument.)
HJMTree is the Heath-Jarrow-Morton tree sampling of a forward-rate process, created using hjmtree. BDTTree is the Black-Derman-Toy tree sampling of an interest-rate process, created using bdttree. See Building a Tree of Forward Rates to learn how to create these structures.
InstSet is the set of instruments to be priced. This structure represents the set of instruments to be priced independently using the model. Getting Started, explains how to create this variable.
Options is an options structure created with the function derivset. This structure defines how the tree is used to find the price of instruments in the portfolio, and how much additional information is displayed in the command window when calling the pricing function. If this input argument is not specified in the call to the pricing function, a default Options structure is used. The pricing options structure is described in Pricing Options Structure.
The portfolio pricing functions classify the instruments and call the appropriate instrument-specific pricing function for each of the instrument types. The HJM instrument-specific pricing functions are bondbyhjm, cfbyhjm, fixedbyhjm, floatbyhjm, optbndbyhjm, rangefloatbyhjm, swapbyhjm, and swaptionbyhjm. A similarly named set of functions exists for BDT models. For a list of these, see Black-Derman-Toy Tree Utilities.
You can also use these functions directly to calculate the price of sets of instruments of the same type. See Functions — Alphabetical List for these individual functions for further information.
Consider the following example, which uses the portfolio and interest-rate data in the MAT-file deriv.mat included in the toolbox. Load the data into the MATLAB workspace.
load deriv.mat
Use the MATLAB whos command to display a list of the variables loaded from the MAT-file.
whos Name Size Bytes Class Attributes BDTInstSet 1x1 15956 struct BDTTree 1x1 5138 struct BKInstSet 1x1 15946 struct BKTree 1x1 5904 struct CRRInstSet 1x1 12434 struct CRRTree 1x1 5058 struct EQPInstSet 1x1 12434 struct EQPTree 1x1 5058 struct HJMInstSet 1x1 15948 struct HJMTree 1x1 5838 struct HWInstSet 1x1 15946 struct HWTree 1x1 5904 struct ITTInstSet 1x1 12438 struct ITTTree 1x1 8862 struct ZeroInstSet 1x1 10282 struct ZeroRateSpec 1x1 1580 struct
HJMTree and HJMInstSet are the input arguments required to call the function hjmprice.
Use the function instdisp to examine the set of instruments contained in the variable HJMInstSet.
instdisp(HJMInstSet) Index Type CouponRate Settle Maturity Period Basis ... Name Quantity 1 Bond 0.04 01-Jan-2000 01-Jan-2003 1 NaN ... 4% bond 100 2 Bond 0.04 01-Jan-2000 01-Jan-2004 2 NaN ... 4% bond 50 Index Type UnderInd OptSpec Strike ExerciseDates AmericanOpt Name Quantity 3 OptBond 2 call 101 01-Jan-2003 NaN Option 101 -50 Index Type CouponRate Settle Maturity FixedReset Basis Principal Name Quantity 4 Fixed 0.04 01-Jan-2000 01-Jan-2003 1 NaN NaN 4% Fixed 80 Index Type Spread Settle Maturity FloatReset Basis Principal Name Quantity 5 Float 20 01-Jan-2000 01-Jan-2003 1 NaN NaN 20BP Float 8 Index Type Strike Settle Maturity CapReset Basis Principal Name Quantity 6 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 7 Floor 0.03 01-Jan-2000 01-Jan-2004 1 NaN NaN 3% Floor 40 Index Type LegRate Settle Maturity LegReset Basis Principal LegType Name Quantity 8 Swap [0.06 20] 01-Jan-2000 01-Jan-2003 [1 1] NaN NaN [NaN] 6%/20BP Swap 10 |
Note that there are eight instruments in this portfolio set: two bonds, one bond option, one fixed-rate note, one floating-rate note, one cap, one floor, and one swap. Each instrument has a corresponding index that identifies the instrument prices in the price vector returned by hjmprice.
Now use hjmprice to calculate the price of each instrument in the instrument set.
Price = hjmprice(HJMTree, HJMInstSet)
Warning: Not all cash flows are aligned with the tree. Result will
be approximated.
Price =
98.7159
97.5280
0.0486
98.7159
100.5529
6.2831
0.0486
3.6923
Note The warning shown above appears because some of the cash flows for the second bond do not fall exactly on a tree node. |
Load the MAT-file deriv.mat into the MATLAB workspace.
load deriv.mat
Use the MATLAB whos command to display a list of the variables loaded from the MAT-file.
whos Name Size Bytes Class Attributes BDTInstSet 1x1 15956 struct BDTTree 1x1 5138 struct BKInstSet 1x1 15946 struct BKTree 1x1 5904 struct CRRInstSet 1x1 12434 struct CRRTree 1x1 5058 struct EQPInstSet 1x1 12434 struct EQPTree 1x1 5058 struct HJMInstSet 1x1 15948 struct HJMTree 1x1 5838 struct HWInstSet 1x1 15946 struct HWTree 1x1 5904 struct ITTInstSet 1x1 12438 struct ITTTree 1x1 8862 struct ZeroInstSet 1x1 10282 struct ZeroRateSpec 1x1 1580 struct
BDTTree and BDTInstSet are the input arguments required to call the function bdtprice.
Use the function instdisp to examine the set of instruments contained in the variable BDTInstSet.
instdisp(BDTInstSet) Index Type CouponRate Settle Maturity Period Basis ........ Name Quantity 1 Bond 0.1 01-Jan-2000 01-Jan-2003 1 NaN......... 10% bond 100 2 Bond 0.1 01-Jan-2000 01-Jan-2004 2 NaN......... 10% bond 50 Index Type UnderInd OptSpec Strike ExerciseDates AmericanOpt Name Quantity 3 OptBond 1 call 9501 Jan-2002 NaN Option 95 -50 Index Type CouponRate Settle Maturity FixedReset Basis Principal Name Quantity 4 Fixed 0.10 01-Jan-2000 01-Jan-2003 1 NaN NaN 10% Fixed 80 Index Type Spread Settle Maturity FloatReset Basis Principal Name Quantity 5 Float 20 01-Jan-2000 01-Jan-2003 1 NaN NaN 20BP Float 8 Index Type Strike Settle Maturity CapReset Basis Principal Name Quantity 6 Cap 0.15 01-Jan-2000 01-Jan-2004 1 NaN NaN 15% Cap 30 Index Type Strike Settle Maturity FloorReset Basis Principal Name Quantity 7 Floor 0.09 01-Jan-2000 01-Jan-2004 1 NaN NaN 9% Floor 40 Index Type LegRate Settle Maturity LegReset Basis Principal LegType Name Quantity 8 Swap [0.15 10] 01-Jan-2000 01-Jan-2003 [1 1] NaN NaN [NaN] 15%/10BP Swap 10 |
Note that there are eight instruments in this portfolio set: two bonds, one bond option, one fixed-rate note, one floating-rate note, one cap, one floor, and one swap. Each instrument has a corresponding index that identifies the instrument prices in the price vector returned by bdtprice.
Now use bdtprice to calculate the price of each instrument in the instrument set.
Price = bdtprice(BDTTree, BDTInstSet)
Warning: Not all cash flows are aligned with the tree. Result will
be approximated.
Price =
95.5030
93.9079
1.7657
95.5030
100.4865
1.4863
0.0245
7.4222The prices in the output vector Price correspond to the prices at observation time zero (tObs = 0), which is defined as the valuation date of the interest-rate tree. The instrument indexing within Price is the same as the indexing within InstSet.
In the HJM example, the prices in the Price vector correspond to the instruments in this order.
InstNames = instget(HJMInstSet, 'FieldName','Name') InstNames = 4% bond 4% bond Option 101 4% Fixed 20BP Float 3% Cap 3% Floor 6%/20BP Swap
Consequently, in the Price vector, the fourth element, 98.7159, represents the price of the fourth instrument (4% fixed-rate note); the sixth element, 6.2831, represents the price of the sixth instrument (3% cap).
In the BDT example, the prices in the Price vector correspond to the instruments in this order.
InstNames = instget(BDTInstSet, 'FieldName','Name') InstNames = 10% Bond 10% Bond Option 95 10% Fixed 20BP Float 15% Cap 9% Floor 15%/10BP Swap
Consequently, in the Price vector, the fourth element, 95.5030, represents the price of the fourth instrument (10% fixed-rate note); the sixth element, 1.4863, represents the price of the sixth instrument (15% cap).
If you call a pricing function with two output arguments, for example,
[Price, PriceTree] = hjmprice(HJMTree, HJMInstSet)
you generate a price tree along with the price information.
The optional output price tree structure PriceTree holds all the pricing information.
HJM Price Tree. In the HJM example, the first field of this structure, FinObj, indicates that this structure represents a price tree. The second field, PBush, is the tree holding the price of the instruments in each node of the tree. The third field, AIBush, is the tree holding the accrued interest of the instruments in each node of the tree. Finally, the fourth field, tObs, represents the observation time of each level of PBush and AIBush, with units in terms of compounding periods.
In this example, the price tree looks like
PriceTree =
FinObj: 'HJMPriceTree'
PBush: {[8x1 double] [8x1x2 double] ...[8x8 double]}
AIBush: {[8x1 double] [8x1x2 double] ... [8x8 double]}
tObs: [0 1 2 3 4]
Both PBush and AIBush are 1-by-5 cell arrays, consistent with the five observation times of tObs. The data display has been shortened here to fit on a single line.
Using the command line interface, you can directly examine PriceTree.PBush, the field within the PriceTree structure that contains the price tree with the price vectors at every state. The first node represents tObs = 0, corresponding to the valuation date.
PriceTree.PBush{1}
ans =
98.7159
97.5280
0.0486
98.7159
100.5529
6.2831
0.0486
3.6923
With this interface, you can observe the prices for all instruments in the portfolio at a specific time.
BDT Price Tree. The BDT output price tree structure PriceTree holds all the pricing information. The first field of this structure, FinObj, indicates that this structure represents a price tree. The second field, PTree, is the tree holding the price of the instruments in each node of the tree. The third field, AITree, is the tree holding the accrued interest of the instruments in each node of the tree. The fourth field, tObs, represents the observation time of each level of PTree and AITree, with units in terms of compounding periods.
You can directly examine the field within the PriceTree structure, which contains the price tree with the price vectors at every state. The first node represents tObs = 0, corresponding to the valuation date.
[Price, PriceTree] = bdtprice(BDTTree, BDTInstSet)
PriceTree.PTree{1}
ans =
95.5030
93.9079
1.7657
95.5030
100.4865
1.4863
0.0245
7.4222
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.
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. |
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.
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.42To 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.42The pricing of interest rate derivative securities relies on models that describe the underlying process. These interest rate models depend on one or more parameters that you must determine by matching the model predictions to the existing data available in the market. In the Hull-White model, there are two parameters related to the short rate process: mean reversion and volatility. Calibration is used to determine these parameters, such that the model can reproduce, as close as possible, the prices of caps or floors observed in the market. The calibration routines find the parameters that minimize the difference between the model price predictions and the market prices for caps and floors.
For a Hull-White model, the minimization is two dimensional, with respect to mean reversion (α) and volatility (σ). That is, calibrating the Hull-White model minimizes the difference between the model prices and market prices for caps and floors:
![]()
Use market data to identify the implied volatility (σ) and mean reversion (α) coefficients needed to build a Hull-White tree to price an instrument. The ideal case is to use the volatilities of the caplets, or floorlets, that correspond to the cap, or floor, used to calculate Alpha (α) and Sigma (σ). This will most likely not be the case, so market data must be interpolated to obtain the required values.
Consider a cap with these parameters:
Settle = ' Jan-21-2008'; Maturity = 'Mar-21-2011'; Strike = 0.0690; Reset = 4; Principal = 1000; Basis = 0;
The caplets for this example would fall in:
capletDates = cfdates(Settle, Maturity, Reset, Basis); datestr(capletDates') ans = 21-Mar-2008 21-Jun-2008 21-Sep-2008 21-Dec-2008 21-Mar-2009 21-Jun-2009 21-Sep-2009 21-Dec-2009 21-Mar-2010 21-Jun-2010 21-Sep-2010 21-Dec-2010 21-Mar-2011
In the best case, look up the market volatilities for caplets with a Strike = 0.0690, and maturities in each reset date listed, but the likelihood of finding these exact instruments is low. As a consequence, use data that is available in the market and interpolate to find appropriate values for the caplets.
Based on the market data, you have the caplet information for the same dates, but for different strikes. That is, the strike for the cap is not included. Assume that instead of having the data for Strike = 0.0690, you have the data for the same dates but for Strike1 = 0.0590 and Strike2 = 0.0790
| Maturity | Strike1 = 0.0590 | Strike2 = 0.0790 |
|---|---|---|
| 21-Mar-2008 | 0.1533 | 0. 1526 |
| 21-Jun-2008 | 0.1731 | 0. 1730 |
| 21-Sep-2008 | 0. 1727 | 0. 1726 |
| 21-Dec-2008 | 0. 1752 | 0. 1747 |
| 21-Mar-2009 | 0. 1809 | 0. 1808 |
| 21-Jun-2009 | 0. 1809 | 0. 1792 |
| 21-Sep-2009 | 0. 1805 | 0. 1797 |
| 21-Dec-2009 | 0. 1802 | 0. 1794 |
| 21-Mar-2010 | 0. 1802 | 0. 1733 |
| 21-Jun-2010 | 0. 1757 | 0. 1751 |
| 21-Sep-2010 | 0. 1755 | 0. 1750 |
| 21-Dec-2010 | 0. 1755 | 0. 1745 |
| 21-Mar-2011 | 0. 1726 | 0. 1719 |
The nature of this data lends itself to matrix nomenclature, which is perfect for MATLAB. hwcalbycap requires that the dates, the strikes, and the actual volatility be separated into three variables: MarketStrike, MarketMat, and MarketVol.
MarketStrike = [0.0590; 0.0790];
MarketMat = {'21-Mar-2008';
'21-Jun-2008';
'21-Sep-2008';
'21-Dec-2008';
'21-Mar-2009';
'21-Jun-2009';
'21-Sep-2009';
'21-Dec-2009';
'21-Mar-2010';
'21-Jun-2010';
'21-Sep-2010';
'21-Dec-2010';
'21-Mar-2011'};
MarketVol = [0.1533 0.1731 0.1727 0.1752 0.1809 0.1800 0.1805 0.1802 0.1735 0.1757 ...
0.1755 0.1755 0.1726; % First column in table corresponding to Strike1
0.1526 0.1730 0.1726 0.1747 0.1808 0.1792 0.1797 0.1794 0.1733 0.1751 ...
0.1750 0.1745 0.1719]; % Second column in table corresponding to Strike2Complete the input arguments using this data for RateSpec:
Rates= [0.0627;
0.0657;
0.0691;
0.0717;
0.0739;
0.0755;
0.0765;
0.0772;
0.0779;
0.0783;
0.0786;
0.0789;
0.0792;
0.0793];
ValuationDate = '21-Jan-2008';
EndDates = {'21-Mar-2008';'21-Jun-2008';'21-Sep-2008';'21-Dec-2008';...
'21-Mar-2009';'21-Jun-2009';'21-Sep-2009';'21-Dec-2009';....
'21-Mar-2010';'21-Jun-2010';'21-Sep-2010';'21-Dec-2010';....
'21-Mar-2011';'21-Jun-2011'};
Compounding = 4;
Basis = 0;
RateSpec = intenvset('ValuationDate', ValuationDate, ...
'StartDates', ValuationDate, 'EndDates', EndDates, ...
'Rates', Rates, 'Compounding', Compounding, 'Basis', Basis);
RateSpec =
FinObj: 'RateSpec'
Compounding: 4
Disc: [14x1 double]
Rates: [14x1 double]
EndTimes: [14x1 double]
StartTimes: [14x1 double]
EndDates: [14x1 double]
StartDates: 733428
ValuationDate: 733428
Basis: 0
EndMonthRule: 1Call the calibration routine to find values for volatility parameters Alpha and Sigma. Use hwcalbycap to calculate the values of Alpha and Sigma based on market data. Internally, hwcalbycap calls the Optimization Toolbox™ function lsqnonlin. You can customize lsqnonlin by passing an optimization options structure created by optimset and then this can be passed to hwcalbycap using the name-value pair argument for OptimOptions. For example, optimset defines the target objective function tolerance as 100*eps and then calls hwcalbycap:
o=optimset('TolFun',100*eps);
[Alpha, Sigma] = hwcalbycap(RateSpec, MarketStrike, MarketMat, MarketVol,...
Strike, Settle, Maturity, 'Reset', Reset, 'Principal', Principal, 'Basis',...
Basis, 'OptimOptions', o)
Local minimum possible.
Local minimum possible.
lsqnonlin stopped because the size of the current step is less than
the default value of the step size tolerance. Warning: LSQNONLIN did not converge to an optimal
solution. It exited with exitflag = 2.
> In hwcalbycapfloor at 97
In hwcalbycap at 77
Alpha =
1.0000e-006
Sigma =
0.0127The previous warning indicates that the conversion was not optimal. The search algorithm used by the Optimization Toolbox™ function lsqnonlin did not find a solution that conforms to all the constraints. To discern whether the solution is acceptable, look at the results of the optimization by specifying a third output (OptimOut) for hwcalbycap:
[Alpha, Sigma, OptimOut] = hwcalbycap(RateSpec, MarketStrike, MarketMat,... MarketVol, Strike, Settle, Maturity, 'Reset', Reset, 'Principal', Principal,... 'Basis', Basis, 'OptimOptions', o);
The OptimOut.residual field of the OptimOut structure is the optimization residual. This value contains the difference between the Black caplets and those calculated during the optimization. You can use the OptimOut.residual value to calculate the percentual difference (error) compared to Black caplet prices and then decide whether the residual is acceptable. There is almost always some residual, so decide if parametrizing the market with a single value of Alpha and Sigma is acceptable.
Price caplets using market data and Black's formula to obtain reference caplet values. To determine the effectiveness of the optimization, calculate reference caplet values using Black's formula and the market data. Note, you must first interpolate the market data to obtain the caplets for calculation:
MarketMatNum = datenum(MarketMat); [Mats, Strikes] = meshgrid(MarketMatNum, MarketStrike); FlatVol = interp2(Mats, Strikes, MarketVol, datenum(Maturity), Strike, 'spline');
Compute the price of the cap using the Black model:
[CapPrice, Caplets] = capbyblk(RateSpec, Strike, Settle, Maturity, FlatVol,...
'Reset', Reset, 'Basis', Basis, 'Principal', Principal);
Caplets = Caplets(2:end)';
Caplets =
0.3210
1.6355
2.4863
3.1903
3.4110
3.2685
3.2385
3.4803
3.2419
3.1949
3.2991
3.3750Compare optimized values and Black values and display graphically. After calculating the reference values for the caplets, compare the values, analytically and graphically, to determine whether the calculated single values of Alpha and Sigma provide an adequate approximation:
OptimCaplets = Caplets+OptimOut.residual;
disp(' ');
disp(' Black76 Calibrated Caplets');
disp([Caplets OptimCaplets])
plot(MarketMatNum(2:end), Caplets, 'or', MarketMatNum(2:end), OptimCaplets, '*b');
datetick('x', 2)
xlabel('Caplet Maturity');
ylabel('Caplet Price');
title('Black and Calibrated Caplets');
h = legend('Black Caplets', 'Calibrated Caplets');
set(h, 'color', [0.9 0.9 0.9]);
set(h, 'Location', 'SouthEast');
set(gcf, 'NumberTitle', 'off')
grid on
Black76 Calibrated Caplets
0.3210 0.3636
1.6355 1.6603
2.4863 2.4974
3.1903 3.1874
3.4110 3.4040
3.2685 3.2639
3.2385 3.2364
3.4803 3.4683
3.2419 3.2408
3.1949 3.1957
3.2991 3.2960
3.3750 3.3663

Compare cap prices using the Black, HW analytical, and HW tree models. Using the calculated caplet values, compare the prices of the corresponding cap using the Black model, Hull-White analytical, and Hull-White tree models. To calculate a Hull-White tree based on Alpha and Sigma, use these calibration routines:
Black model:
CapPriceBLK = CapPrice;
HW analytical model:
CapPriceHWAnalytical = sum(OptimCaplets);
HW tree model to price the cap derived from the calibration process:
Create VolSpec from the calibration parameters Alpha and Sigma:
VolDates = EndDates; VolCurve = Sigma*ones(14,1); AlphaDates = EndDates; AlphaCurve = Alpha*ones(14,1); HWVolSpec = hwvolspec(ValuationDate, VolDates, VolCurve,AlphaDates, AlphaCurve);
Create the TimeSpec:
HWTimeSpec = hwtimespec(ValuationDate, EndDates, Compounding);
Build the HW tree using the HW2000 method:
HWTree = hwtree(HWVolSpec, RateSpec, HWTimeSpec, 'Method', 'HW2000');
Price the cap:
Price = capbyhw(HWTree, Strike, Settle, Maturity, Reset, Basis, Principal);
disp(' ');
disp([' CapPrice Black76 ..................: ', num2str(CapPriceBLK,'%15.5f')]);
disp([' CapPrice HW analytical..........: ', num2str(CapPriceHWAnalytical,'%15.5f')]);
disp([' CapPrice HW from capbyhw ..: ', num2str(Price,'%15.5f')]);
disp(' ');
CapPrice Black76 ..........: 34.14220
CapPrice HW analytical.....: 34.18008
CapPrice HW from capbyhw ..: 34.14192Price a portfolio of instruments using the calibrated HW tree. After building a Hull-White tree, based on parameters calibrated from market data, use HWTree to price a portfolio of these instruments:
Two bonds
CouponRate = [0.07; 0.09];
Settle= ' Jan-21-2008';
Maturity = {'Mar-21-2010';'Mar-21-2011'};
Period = 1;
Face = 1000;
Basis = 0;
Bond with an embedded American call option
CouponRateOEB = 0.08; SettleOEB = ' Jan-21-2008'; MaturityOEB = 'Mar-21-2011'; OptSpec = 'call'; StrikeOEB = 950; ExerciseDatesOEB = 'Mar-21-2011'; AmericanOpt= 1; Period =1; Face = 1000; Basis =0;
To price this portfolio of instruments using the calibrated HWTree:
Use instadd to create the portfolio InstSet:
InstSet = instadd('Bond', CouponRate, Settle, Maturity, Period, Basis, [], [], [], [], [], Face);
InstSet = instadd(InstSet,'OptEmBond', CouponRateOEB, SettleOEB, MaturityOEB, OptSpec,...
StrikeOEB, ExerciseDatesOEB, 'AmericanOpt', AmericanOpt, 'Period', Period,...
'Face',Face, 'Basis', Basis);
Add the cap instrument used in the calibration:
SettleCap = ' Jan-21-2008'; MaturityCap = 'Mar-21-2011'; StrikeCap = 0.0690; Reset = 4; Principal = 1000; InstSet = instadd(InstSet,'Cap', StrikeCap, SettleCap, MaturityCap, Reset, Basis, Principal);
Assign names to the portfolio instruments:
Names = {'7% Bond'; '8% Bond'; 'BondEmbCall'; '6.9% Cap'};
InstSet = instsetfield(InstSet, 'Index',1:4, 'FieldName', {'Name'}, 'Data', Names );Examine the set of instruments contained in InstSet:
instdisp(InstSet) IdxType CoupRate Settle Mature Period Basis EOMRule IssueDate 1stCoupDate LastCoupDate StartDate Face Name 1 Bond 0.07 21-Jan-2008 21-Mar-2010 1 0 NaN NaN NaN NaN NaN 1000 7% Bond 2 Bond 0.09 21-Jan-2008 21-Mar-2011 1 0 NaN NaN NaN NaN NaN 1000 8% Bond IdxType CoupRate Settle Mature OptSpec Stke ExDate Per Basis EOMRule IssDate 1stCoupDate LstCoupDate StrtDate Face AmerOpt Name 3 OptEmBond 0.08 21-Jan-2008 21-Mar-2011 call 950 21-Jan-2008 21-Mar-2011 1 0 1 NaN NaN NaN NaN 1000 1 BondEmbCall Index Type Strike Settle Maturity CapReset Basis Principal Name 4 Cap 0.069 21-Jan-2008 21-Mar-2011 4 0 1000 6.9% Cap |
Use hwprice to price the portfolio using the calibrated HWTree:
format bank
PricePortfolio = hwprice(HWTree, InstSet)
PricePortfolio =
980.45
1023.05
945.73
34.14
![]() | Understanding Interest-Rate Tree Models | Interest-Rate Derivatives Using Closed-Form Solutions | ![]() |
View demos and recorded presentations led by industry experts.
Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |