hjmtimespec
Specify time structure for Heath-Jarrow-Morton interest-rate tree
Description
sets the number of levels and node times for a TimeSpec
= hjmtimespec(ValuationDate
,Maturity
)hjmtree
and determines the mapping between dates and time for rate
quoting.
adds the optional argument TimeSpec
= hjmtimespec(___,Compounding
)Compounding
.
Examples
Set the Number of Levels and Node Times for an HJM Tree
This example shows how to specify an eight-period tree with semiannual nodes (every six months) and use exponential compounding to report rates.
Compounding = -1; ValuationDate = datetime(1999,1,15); Maturity = datemnth(ValuationDate, 6*(1:8)'); TimeSpec = hjmtimespec(ValuationDate, Maturity, Compounding)
TimeSpec = struct with fields:
FinObj: 'HJMTimeSpec'
ValuationDate: 730135
Maturity: [8x1 double]
Compounding: -1
Basis: 0
EndMonthRule: 1
Input Arguments
ValuationDate
— Pricing date and first observation in the tree
datetime scalar | string scalar | date character vector
Pricing date and first observation in the tree, specified as a scalar datetime, string, or date character vector.
To support existing code, hjmtimespec
also
accepts serial date numbers as inputs, but they are not recommended.
Maturity
— Dates marking the cash flow dates of the tree
datetime array | string array | date character vector
Dates marking the cash flow dates of the tree, specified as
NLEVELS
-by-1
vector using a datetime array,
string array, or date character vectors. Cash flows with these maturities fall on tree
nodes. Maturity
should be in increasing order.
To support existing code, hjmtimespec
also
accepts serial date numbers as inputs, but they are not recommended.
Compounding
— Rate at which the input zero rates were compounded when annualized
1
(default) | integer with value of 1
, 2
, 3
, 4
, 6
, 12
, 365
, or -1
(Optional) Rate at which the input zero rates were compounded when annualized, specified as a scalar integer value.
If
Compounding
=1
,2
,3
,4
,6
,12
:Disc = (1 + Z/F)^(-T)
, whereF
is the compounding frequency,Z
is the zero rate, andT
is the time in periodic units; for example,T = F
is one year.If
Compounding
=365
:Disc = (1 + Z/F)^(-T)
, whereF
is the number of days in the basis year andT
is a number of days elapsed computed by basis.If
Compounding
=−1
:Disc = exp(-T*Z)
, whereT
is time in years.
Data Types: double
Output Arguments
TimeSpec
— Specification for the time layout for hjmtree
structure
Version History
Introduced before R2006aR2022b: Serial date numbers not recommended
Although hjmtimespec
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.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
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.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)