| Financial Derivatives Toolbox™ | ![]() |
Price = hjmprice(HJMTree, InstSet, Options)
HJMTree | Heath-Jarrow-Morton tree sampling a forward-rate process. See hjmtree for information on creating HJMTree. |
InstSet | Variable containing a collection of instruments. Instruments are categorized by type. Each type can have different data fields. The stored data field is a row vector or string for each instrument. |
Options | (Optional) Derivatives pricing options structure created with derivset. |
Price = hjmprice(HJMTree, InstSet, Options) computes arbitrage-free prices for instruments using an interest-rate tree created with hjmtree. A subset of NINST instruments from a financial instrument variable, InstSet, are priced.
Price is a NINST-by-1 vector of prices for each instrument. The prices are computed by backward dynamic programming on the interest-rate tree. If an instrument cannot be priced, NaN is returned.
PriceTree is a MATLAB® structure of trees containing vectors of instrument prices and accrued interest, and a vector of observation times for each node.
PriceTree.PBush contains the clean prices.
PriceTree.AIBush contains the accrued interest.
PriceTree.tObs contains the observation times.
hjmprice handles instrument types: 'Bond', 'CashFlow', 'OptBond', 'OptEmBond', 'Fixed', 'Float', 'Cap', 'Floor', 'Swap'. See instadd to construct defined types.
Related single-type pricing functions are
bondbyhjm: Price a bond from an HJM tree.
capbyhjm: Price a cap from an HJM tree.
cfbyhjm: Price an arbitrary set of cash flows from an HJM tree.
fixedbyhjm: Price a fixed-rate note from an HJM tree.
floatbyhjm: Price a floating-rate note from an HJM tree.
floorbyhjm: Price a floor from an HJM tree.
optbndbyhjm: Price a bond option from an HJM tree.
optembndbyhjm: Price a bond with embedded option by an HJM tree.
swapbyhjm: Price a swap from an HJM tree.
swaptionbyhjm: Price a swaption from an HJM tree.
Load the HJM tree and instruments from the data file deriv.mat. Price the cap and bond instruments contained in the instrument set.
load deriv.mat;
HJMSubSet = instselect(HJMInstSet,'Type', {'Bond', 'Cap'});
instdisp(HJMSubSet)
Index Type CouponRate Settle Maturity Period Name ...
1 Bond 0.04 01-Jan-2000 01-Jan-2003 1 4% bond
2 Bond 0.04 01-Jan-2000 01-Jan-2004 2 4% bond
Index Type Strike Settle Maturity CapReset... Name ...
3 Cap 0.03 01-Jan-2000 01-Jan-2004 1 3% Cap
[Price, PriceTree] = hjmprice(HJMTree, HJMSubSet)
Warning: Not all cash flows are aligned with the tree. Result will
be approximated.
Price =
98.7159
97.5280
6.2831
PriceTree =
FinObj: 'HJMPriceTree'
PBush: {1x5 cell}
AIBush: {1x5 cell}
tObs: [0 1 2 3 4]
You can use treeviewer to see the prices of these three instruments along the price tree.
treeviewer(PriceTree, HJMSubSet)

hjmsens, hjmtree, hjmvolspec, instadd, intenvprice, intenvsens
![]() | hedgeslf | hjmsens | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |