Pricing Using Interest-Rate Tree Models
Introduction
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.
Computing Instrument Prices
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 
- Floating-rate notes with options or embedded options 
- 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 Pricing Options Structure 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. 
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. You can also use these functions directly to
                calculate the price of sets of instruments of the same type. 
HJM Pricing
This example shows how to price an HJM tree and uses the portfolio and interest-rate data in the MAT-file deriv.mat.
Load the data.
load deriv.matUse the MATLAB® whos command to display a list of the variables loaded from the MAT-file.
whos
Name Size Bytes Class Attributes BDTInstSet 1x1 28737 struct BDTTree 1x1 6289 struct BKInstSet 1x1 28727 struct BKTree 1x1 7355 struct CIRInstSet 1x1 31123 struct CIRTree 1x1 6784 struct CRRInstSet 1x1 22035 struct CRRTree 1x1 5832 struct EQPInstSet 1x1 22035 struct EQPTree 1x1 5832 struct HJMInstSet 1x1 28729 struct HJMTree 1x1 7206 struct HWInstSet 1x1 28727 struct HWTree 1x1 7355 struct ITTInstSet 1x1 22039 struct ITTTree 1x1 11367 struct STTInstSet 1x1 22039 struct STTTree 1x1 6600 struct ZeroInstSet 1x1 18203 struct ZeroRateSpec 1x1 1732 struct
HJMTree and HJMInstSet are the input arguments required to call the function hjmprice. Use the instselect command to select Floor and Cap instruments. 
HJMSubSet = instselect(HJMInstSet,'Type', {'Floor','Cap'});
Use the function instdisp to examine the set of instruments contained in the variable HJMSubSet.
instdisp(HJMSubSet)
Index Type Strike Settle Maturity CapReset Basis Principal Name Quantity 1 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 2 Floor 0.03 01-Jan-2000 01-Jan-2004 1 NaN NaN 3% Floor 40
Use hjmprice to calculate the price of the Cap and Floor instruments in the instrument set.
Price = hjmprice(HJMTree, HJMSubSet)
Price = 2×1
    6.2831
    0.0486
BDT Pricing
This example shows how to price a BDT tree and uses the portfolio and interest-rate data in the MAT-file deriv.mat.
Load the data.
load deriv.matUse the MATLAB® whos command to display a list of the variables loaded from the MAT-file.
whos
Name Size Bytes Class Attributes BDTInstSet 1x1 28737 struct BDTTree 1x1 6289 struct BKInstSet 1x1 28727 struct BKTree 1x1 7355 struct CIRInstSet 1x1 31123 struct CIRTree 1x1 6784 struct CRRInstSet 1x1 22035 struct CRRTree 1x1 5832 struct EQPInstSet 1x1 22035 struct EQPTree 1x1 5832 struct HJMInstSet 1x1 28729 struct HJMTree 1x1 7206 struct HWInstSet 1x1 28727 struct HWTree 1x1 7355 struct ITTInstSet 1x1 22039 struct ITTTree 1x1 11367 struct STTInstSet 1x1 22039 struct STTTree 1x1 6600 struct ZeroInstSet 1x1 18203 struct ZeroRateSpec 1x1 1732 struct
BDTTree and BDTInstSet are the input arguments required to call the function bdtprice. Use the instselect command to select Floor and Cap instruments. 
BDTSubSet = instselect(BDTInstSet,'Type', {'Floor','Cap'});
Use the function instdisp to examine the set of instruments contained in the variable BDTSubSet.
instdisp(BDTSubSet)
Index Type Strike Settle Maturity CapReset Basis Principal Name Quantity 1 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 2 Floor 0.09 01-Jan-2000 01-Jan-2004 1 NaN NaN 9% Floor 40
Use bdtprice to calculate the price of the Cap and Floor instruments in the instrument set.
Price = bdtprice(BDTTree, BDTSubSet)
Price = 2×1
    1.4375
    0.0245
Price Vector Output
The 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
So, 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
So, 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).
Price Tree Structure Output
If you call a pricing function with two output arguments, for example,
[Price, PriceTree] = hjmprice(HJMTree, HJMInstSet)
Warning: Not all cash flows are aligned with the tree. Result will be approximated. 
> In checktree (line 292)
In hjmprice (line 85) 
Price =
   98.7159
   97.5280
    0.0486
   98.7159
  100.5529
    6.2831
    0.0486
    3.6923
PriceTree = 
  struct with fields:
    FinObj: 'HJMPriceTree'
     PBush: {[8×1 double]  [8×1×2 double]  [8×2×2 double]  [8×4×2 double]  [8×8 double]}
    AIBush: {[8×1 double]  [8×1×2 double]  [8×2×2 double]  [8×4×2 double]  [8×8 double]}
    ExBush: {[8×1 double]  [8×1×2 double]  [8×2×2 double]  [8×4×2 double]  [8×8 double]}
      tObs: [0 1 2 3 4]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 this:
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
See Also
instbond | instcap | instcf | instfixed | instfloat | instfloor | instoptbnd | instoptembnd | instoptfloat | instoptemfloat | instrangefloat | instswap | instswaption | intenvset | bondbyzero | cfbyzero | fixedbyzero | floatbyzero | intenvprice | intenvsens | swapbyzero | floatmargin | floatdiscmargin | hjmtimespec | hjmtree | hjmvolspec | bondbyhjm | capbyhjm | cfbyhjm | fixedbyhjm | floatbyhjm | floorbyhjm | hjmprice | hjmsens | mmktbyhjm | oasbyhjm | optbndbyhjm | optfloatbyhjm | optembndbyhjm | optemfloatbyhjm | rangefloatbyhjm | swapbyhjm | swaptionbyhjm | bdttimespec | bdttree | bdtvolspec | bdtprice | bdtsens | bondbybdt | capbybdt | cfbybdt | fixedbybdt | floatbybdt | floorbybdt | mmktbybdt | oasbybdt | optbndbybdt | optfloatbybdt | optembndbybdt | optemfloatbybdt | rangefloatbybdt | swapbybdt | swaptionbybdt | hwtimespec | hwtree | hwvolspec | bondbyhw | capbyhw | cfbyhw | fixedbyhw | floatbyhw | floorbyhw | hwcalbycap | hwcalbyfloor | hwprice | hwsens | oasbyhw | optbndbyhw | optfloatbyhw | optembndbyhw | optemfloatbyhw | rangefloatbyhw | swapbyhw | swaptionbyhw | bktimespec | bktree | bkvolspec | bkprice | bksens | bondbybk | capbybk | cfbybk | fixedbybk | floatbybk | floorbybk | oasbybk | optbndbybk | optfloatbybk | optembndbybk | optemfloatbybk | rangefloatbybk | swapbybk | swaptionbybk | capbyblk | floorbyblk | swaptionbyblk
Topics
- Overview of Interest-Rate Tree Models
- Computing Instrument Sensitivities
- Graphical Representation of Trees
- Use treeviewer to Examine HWTree and PriceTree When Pricing European Callable Bond
- Understanding Interest-Rate Tree Models
- Understanding Interest-Rate Term Structure
- Pricing Using Interest-Rate Term Structure
- Supported Interest-Rate Instrument Functions
- Supported Equity Derivative Functions
- Supported Energy Derivative Functions
- Mapping Financial Instruments Toolbox Functions for Interest-Rate Instrument Objects