| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Financial Derivatives Toolbox |
| Contents | Index |
| Learn more about Financial Derivatives Toolbox |
| On this page… |
|---|
Examining Output from the Pricing Functions |
The portfolio pricing functions crrprice, eqpprice, and ittprice calculate the price of any set of supported instruments based on a binary equity price tree or an implied trinomial price tree. These functions are capable of pricing the following instrument types:
Vanilla stock options
American and European puts and calls
Asian
Barrier
Compound
Lookback
Stock options (Bermuda put and call schedules)
The syntax for calling the function crrprice is:
[Price, PriceTree] = crrprice(CRRTree, InstSet, Options)
The syntax for eqpprice is:
[Price, PriceTree] = eqpprice(EQPTree, InstSet, Options)
The syntax for ittprice is:
Price = ittprice(ITTTree, ITTInstSet, Options)
These functions require two input arguments: the equity price tree and the set of instruments, InstSet, and allow a third optional argument.
CRRTree is a CRR equity price tree created using crrtree. EQPTree is an equal probability equity price tree created using eqptree. ITTTree is an ITT equity price tree created using itttree. See Building Equity Binary Trees and Building Implied Trinomial Trees to learn how to create these structures.
InstSet is a structure that represents the set of instruments to be priced independently using the model. Getting Started, explains how to create this variable.
You can enter a third optional argument, Options, used when pricing barrier options. For more specific information, see Derivatives Pricing Options.
These pricing functions internally classify the instruments and call the appropriate individual instrument pricing function for each of the instrument types. The CRR pricing functions are asianbycrr, barrierbycrr, compoundbycrr, lookbackbycrr, and optstockbycrr. A similar set of functions exists for EQP and ITT pricing. You can also use these functions directly to calculate the price of sets of instruments of the same type. See the reference pages for these individual functions for further information.
Consider the following example, which uses the portfolio and stock price 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.
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
CRRTree and CRRInstSet are the required input arguments to call the function crrprice.
Use instdisp to examine the set of instruments contained in the variable CRRInstSet.
instdisp(CRRInstSet)
|
Note Because of space considerations, the compound option above (Index 4) has been condensed to fit the page. The instdisp command displays all compound option fields on your computer screen. |
The instrument set contains eight instruments:
Two vanilla options (Call1, Put1)
One barrier option (Barrier1)
One compound option (Compound1)
Two lookback options (Lookback1, Lookback2)
Two Asian options (Asian1, Asian2)
Each instrument has a corresponding index that identifies the instrument prices in the price vector returned by crrprice.
Now use crrprice to calculate the price of each instrument in the instrument set.
Price = crrprice(CRRTree, CRRInstSet)
Price =
8.2863
2.5016
12.1272
3.3241
7.6015
11.7772
4.1797
3.4219
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.
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
EQPTree and EQPInstSet are the input arguments required to call the function eqpprice.
Use the command instdisp to examine the set of instruments contained in the variable EQPInstSet.
instdisp(EQPInstSet)
|
Note Because of space considerations, the compound option above (Index 4) has been condensed to fit the page. The instdisp command displays all compound option fields on your computer screen. |
The instrument set contains eight instruments:
Two vanilla options (Call1, Put1)
One barrier option (Barrier1)
One compound option (Compound1)
Two lookback options (Lookback1, Lookback2)
Two Asian options (Asian1, Asian2)
Each instrument has a corresponding index that identifies the instrument prices in the price vector returned by eqpprice.
Now use eqpprice to calculate the price of each instrument in the instrument set.
Price = eqpprice(EQPTree, EQPInstSet)
Price =
8.4791
2.6375
12.2632
3.5091
8.7941
12.9577
4.7444
3.9178Consider the following example, which uses the portfolio and stock price 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.
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 8812 struct ZeroInstSet 1x1 10282 struct ZeroRateSpec 1x1 1580 struct
ITTTree and ITTInstSet are the input arguments required to call the function ittprice. Use the command instdisp to examine the set of instruments contained in the variable ITTInstSet.
instdisp(ITTInstSet)
|
The instrument set contains eight instruments:
Two vanilla options (Call1, Put1)
One barrier option (Barrier1)
One compound option (Compound1)
Two lookback options (Lookback1, Lookback2)
Two Asian options (Asian1, Asian2)
Each instrument has a corresponding index that identifies the instrument prices in the price vector returned by ittprice.
Now use ittprice to calculate the price of each instrument in the instrument set.
Price = ittprice(ITTTree, ITTInstSet)
Price =
1.650
10.68
2.407
3.229
0.542
6.184
3.205
6.607The 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 equity tree. The instrument indexing within Price is the same as the indexing within InstSet.
In the CRR example, the prices in the Price vector correspond to the instruments in this order.
InstNames = instget(CRRInstSet, 'FieldName','Name') InstNames = Call1 Put1 Barrier1 Compound1 Lookback1 Lookback2 Asian1 Asian2
Consequently, in the Price vector, the fourth element, 3.3241, represents the price of the fourth instrument (Compound1), and the sixth element, 11.7772, represents the price of the sixth instrument (Lookback2).
In the ITT example, the prices in the Price vector correspond to the instruments in this order.
InstNames = instget(ITTInstSet, 'FieldName','Name') InstNames = Call1 Put1 Barrier1 Compound1 Lookback1 Lookback2 Asian1 Asian2
Consequently, in the Price vector, the first element, 1.650, represents the price of the first instrument (Call1), and the eight element, 6.607, represents the price of the eighth instrument (Asian2).
If you call a pricing function with two output arguments, for example:
[Price, PriceTree] = crrprice(CRRTree, CRRInstSet)
you generate a price tree structure along with the price information.
This price tree structure PriceTree holds all pricing information.
PriceTree =
FinObj: 'BinPriceTree'
PTree: {[8x1 double] [8x2 double] [8x3 double] [8x4 double] [8x5 double]}
tObs: [0 1 2 3 4]
dObs: [731582 731947 732313 732678 733043]The first field of this structure, FinObj, indicates that this structure represents a price tree. The second field, PTree, is the tree holding the prices of the instruments in each node of the tree. Finally, the third and fourth fields, tObs and dObs, represent the observation time and date of each level of PTree, with tObs using units in terms of compounding periods.
Using the command-line interface, you can directly examine PriceTree.PTree, 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.PTree{1}
ans =
8.2863
2.5016
12.1272
3.3241
7.6015
11.7772
4.1797
3.4219With this interface, you can observe the prices for all instruments in the portfolio at a specific time.
The function eqpprice also returns a price tree that you can examine in the same way.
If you call a pricing function with two output arguments, for example:
[Price, PriceTree] = ittprice(ITTTree, ITTInstSet)
you generate a price tree structure along with the price information.
This price tree structure PriceTree holds all pricing information.
PriceTree =
FinObj: 'TrinPriceTree'
PTree: {[8x1 double] [8x3 double] [8x5 double] [8x7 double] [8x9 double]}
tObs: [0 1 2 3 4]
dObs: [732678 733043 733408 733773 734139]The first field of this structure, FinObj, indicates that this structure represents a trinomial price tree. The second field, PTree is the tree holding the prices of the instruments in each node of the tree. Finally, the third and fourth fields, tObs and dObs, represent the observation time and date of each level of PTree, with tObs using units in terms of compounding periods.
Using the command-line interface, you can directly examine PriceTree.PTree, 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.PTree{1}
1.6506
10.6832
2.4074
3.2294
0.5426
6.1845
3.2052
6.6074With this interface, you can observe the prices for all instruments in the portfolio at a specific time.
Lookback options and Asian options are path dependent, and, as such, there are no unique prices for any node except the root node. Consequently, the corresponding values for lookback and Asian options in the price tree are set to NaN, the only exception being the root node. This becomes apparent if you examine the prices in the second node (tobs = 1) of the CRR price tree:
PriceTree.PTree{2}
ans =
11.9176 0
0.9508 7.1914
16.4600 2.6672
2.5896 5.0000
NaN NaN
NaN NaN
NaN NaN
NaN NaN
Examining the prices in the second node (tobs = 1) of the ITT price tree displays:
PriceTree.PTree{2}
ans =
3.9022 0 0
6.3736 13.3743 22.1915
5.6914 0 0
2.7663 3.8594 5.0000
NaN NaN NaN
NaN NaN NaN
NaN NaN NaN
NaN NaN NaNSensitivities 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 crrsens, eqpsens, and ittsens compute the delta, gamma, and vega sensitivities of instruments using a stock 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 (CRRTree and CRRInstSet for CRR, EQPTree and EQPInstSet for EQP, andITTTree and ITTInstSet for ITT).
As with the instrument pricing functions, the optional input argument Options is also allowed. You would include this argument if you want a sensitivity function to generate a price for a barrier option as one of its outputs and want to control the method that the toolbox uses to perform the pricing operation. See Derivatives Pricing Options or the derivset function for more information.
For path-dependent options (lookback and Asian), delta and gamma are computed by finite differences in calls to crrprice, eqpprice, and ittprice. For the other options (stock option, barrier, and compound), delta and gamma are computed from the CRR, EQP, and ITT trees and the corresponding option price tree. (See Chriss, Neil, Black-Scholes and Beyond, pp. 308-312.)
The calling syntax for the sensitivity function is:
[Delta, Gamma, Vega, Price] = crrsens(CRRTree, InstSet, Options)
Using the example data in deriv.mat, calculate the sensitivity of the instruments.
load deriv.mat [Delta, Gamma, Vega, Price] = crrsens(CRRTree, CRRInstSet);
You can conveniently examine the sensitivities and the prices by arranging them into a single matrix.
format bank
All = [Delta, Gamma, Vega, Price]
All =
0.59 0.04 53.45 8.29
-0.31 0.03 67.00 2.50
0.69 0.03 67.00 12.13
-0.12 -0.01 -98.08 3.32
-0.40 -45926.32 88.18 7.60
-0.42 -112143.15 119.19 11.78
0.60 45926.32 49.21 4.18
0.82 112143.15 41.71 3.42
As with the prices, each row of the sensitivity vectors corresponds to the similarly indexed instrument in CRRInstSet. To view the per-dollar sensitivities, divide each dollar sensitivity by the corresponding instrument price.
All = [Delta ./ Price, Gamma ./ Price, Vega ./ Price, Price]
All =
0.07 0.00 6.45 8.29
-0.12 0.01 26.78 2.50
0.06 0.00 5.53 12.13
-0.04 -0.00 -29.51 3.32
-0.05 -6041.77 11.60 7.60
-0.04 -9522.02 10.12 11.78
0.14 10987.98 11.77 4.18
0.24 32771.92 12.19 3.42The calling syntax for the sensitivity function is:
[Delta, Gamma, Vega, Price] = ittsens(ITTTree, ITTInstSet, Options)
Using the example data in deriv.mat, calculate the sensitivity of the instruments.
load deriv.mat
warning('off', 'finderiv:itttree:Extrapolation');
[Delta, Gamma, Vega, Price] = ittsens(ITTTree, ITTInstSet);
You can conveniently examine the sensitivities and the prices by arranging them into a single matrix.
format bank
All = [Delta, Gamma, Vega, Price]
All =
0.24 0.03 19.35 1.65
-0.43 0.02 49.69 10.68
0.35 0.04 12.29 2.41
-0.07 0.00 6.73 3.23
0.63 142945.66 38.90 0.54
0.60 22703.21 68.92 6.18
0.32 -142945.66 18.48 3.21
0.67 -22703.21 17.75 6.61As with the prices, each row of the sensitivity vectors corresponds to the similarly indexed instrument in ITTInstSet.
Note In this example, the extrapolation warnings are turned off before calculating the sensitivities to avoid displaying many warnings on the Command Window as the sensitivities are calculated. |
If the extrapolation warnings are turned on
warning('on', 'finderiv:itttree:Extrapolation');and ittsens is rerun, the extrapolation warnings scroll as the command executes:
[Delta, Gamma, Vega, Price] = ittsens(ITTTree, ITTInstSet) Warning: The option set specified in StockOptSpec was too narrow for the generated tree. This makes extrapolation necessary. The list of options outside of the range of those specified in StockOptSpec are: Option Type: 'call' Maturity: 01-Jan-2007 Strike=66.3529 Option Type: 'put' Maturity: 01-Jan-2007 Strike=50.0061 Option Type: 'put' Maturity: 01-Jan-2008 Strike=50.0061 Option Type: 'put' Maturity: 31-Dec-2008 Strike=50.0061 Option Type: 'call' Maturity: 01-Jan-2010 Strike=155.0141 Option Type: 'put' Maturity: 01-Jan-2010 Strike=50.006 > In itttree>InterpOptPrices at 675 In itttree at 277 In stocktreesens>stocktreedeltagamma_PD at 127 In stocktreesens at 83 In ittsens at 81 Warning: The option set specified in StockOptSpec was too narrow for the generated tree. This made extrapolation necessary. Below is a list of the options that were outside of the range of those specified in StockOptSpec. Option Type: 'call' Maturity: 01-Jan-2007 Strike=66.3367 Option Type: 'put' Maturity: 01-Jan-2007 Strike=37.6773 Option Type: 'call' Maturity: 01-Jan-2008 Strike=66.3367 Option Type: 'put' Maturity: 01-Jan-2008 Strike=28.3951 Option Type: 'call' Maturity: 31-Dec-2008 Strike=66.3367 Option Type: 'call' Maturity: 01-Jan-2010 Strike=66.3367 Option Type: 'put' Maturity: 01-Jan-2010 Strike=16.1276 > In itttree>InterpOptPrices at 675 In itttree at 277 In stocktreesens>stocktreedeltagamma_PD at 131 In stocktreesens at 83 In ittsens at 81 Warning: The option set specified in StockOptSpec was too narrow for the generated tree. This made extrapolation necessary. Below is a list of the options that were outside of the range of those specified in StockOptSpec. Option Type: 'call' Maturity: 01-Jan-2007 Strike=67.2897 Option Type: 'put' Maturity: 01-Jan-2007 Strike=37.1528 Option Type: 'put' Maturity: 01-Jan-2008 Strike=27.6066 Option Type: 'put' Maturity: 31-Dec-2008 Strike=20.5132 Option Type: 'call' Maturity: 01-Jan-2010 Strike=164.0157 Option Type: 'put' Maturity: 01-Jan-2010 Strike=15.2424 > In itttree>InterpOptPrices at 675 In itttree at 277 In stocktreesens>stocktreevega at 191 In stocktreesens at 92 In ittsens at 81
These warnings are a consequence of having to extrapolate to find the option price of the tree nodes. In this example, the set of inputs options was too narrow for the shift in the tree nodes introduced by the disturbance used to calculate the sensitivities. As a consequence extrapolation for some of the nodes was needed. Since the input data is quite close the extrapolated data, the error introduced by extrapolation is fairly low.
You can use the function treeviewer to display a graphical representation of a tree, allowing you to examine interactively the prices and rates on the nodes of the tree until maturity. The graphical representations of CRR and EQP trees are equivalent to Black-Derman-Toy (BDT) trees, given that they are all binary recombining trees. The graphical representations of ITT trees are equivalent to Hull-White (HW) trees, given that they are all trinomial recombining trees. See Graphical Representation of Trees for an overview on the use of treeviewer with CRR trees, EQP trees, and ITT trees and their corresponding option price trees. Follow the instructions for BDT trees.
![]() | Understanding Equity Exotic Options | Equity 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-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |