[Price,PriceTree]
= capbyhjm(HJMTree,Strike,Settle,Maturity) computes
the price of a cap instrument from a Heath-Jarrow-Morton interest-rate
tree. capbyhjm computes prices of vanilla caps
and amortizing caps.
Load the file deriv.mat, which provides HJMTree. The HJMTree structure contains the time and forward-rate information needed to price the cap instrument.
load deriv.mat;
Set the required values. Other arguments will use defaults.
Interest-rate tree structure, specified by using hjmtree.
Data Types: struct
Rate at which cap is exercised, specified as a NINST-by-1 vector
of decimal values.
Data Types: double
Settlement date for the cap, specified as a NINST-by-1
vector using a datetime array, string array, or date character vectors. The
Settle date for every cap is set to the
ValuationDate of the HJM tree. The cap argument
Settle is ignored.
To support existing code, capbyhjm also
accepts serial date numbers as inputs, but they are not recommended.
Maturity date for the cap, specified as a NINST-by-1
vector using a datetime array, string array, or date character vectors.
To support existing code, capbyhjm also
accepts serial date numbers as inputs, but they are not recommended.
(Optional) Reset frequency payment per year, specified as a
NINST-by-1 vector.
Data Types: double
(Optional) Day-count basis representing the basis used when annualizing the input
forward rate, specified as a NINST-by-1 vector
of integers.
(Optional) Notional principal amount, specified as a
NINST-by-1 of notional principal amounts, or a
NINST-by-1 cell array, where each element is a
NumDates-by-2 cell array where the first
column is dates and the second column is associated principal amount. The date
indicates the last day that the principal value is valid.
Use Principal to pass a schedule to compute the price for an
amortizing cap.
Data Types: double | cell
(Optional) Derivatives pricing options structure, specified using derivset.
Expected price of the cap at time 0, returned as a NINST-by-1 vector.
Tree structure with values of the cap at each node, returned as a MATLAB® structure of trees containing vectors of instrument prices and a vector
of observation times for each node:
A cap is a contract that includes a guarantee
that sets the maximum interest rate to be paid by the holder, based on an otherwise floating
interest rate.
Although capbyhjm supports serial date numbers,
datetime values are recommended instead. The
datetime data type provides flexible date and time
formats, storage out to nanosecond precision, and properties to account for time
zones and daylight saving time.
To convert serial date numbers or text to datetime values, use the datetime function. For example:
t = datetime(738427.656845093,"ConvertFrom","datenum");
y = year(t)
y =
2021
There are no plans to remove support for serial date number inputs.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.