cirtimespec
Specify time structure for Cox-Ingersoll-Ross tree
Syntax
Description
creates a time spec for a Cox-Ingersoll-Ross (CIR) tree.TimeSpec
= cirtimespec(ValuationDate
,Maturity
,NumPeriods
)
Note
Alternatively, you can use the Cap
object to price cap
instruments. For more information, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.
adds additional name-value pair arguments.TimeSpec
= cirtimespec(___,Name,Value
)
Examples
Set the Number of Levels and Node Times for a CIR Tree
Set the number of levels and node times for an CIR tree by specifying a four-period tree with time steps of 1 year.
ValuationDate = datetime(2017,1,1); Maturity = datetime(2021,1,1); NumPeriods = 4
NumPeriods = 4
CIRTimeSpec = cirtimespec(ValuationDate, Maturity, NumPeriods)
CIRTimeSpec = struct with fields:
FinObj: 'CIRTimeSpec'
ValuationDate: 736696
Maturity: 738157
NumPeriods: 4
Compounding: 1
Basis: 0
EndMonthRule: 1
tObs: [0 1 2 3 4]
dObs: [736696 737061 737426 737791 738157]
Input Arguments
ValuationDate
— Date marking the pricing date and first observation tree
datetime scalar | string scalar | date character vector
Date marking the pricing date and first observation in the tree, specified as a scalar datetime, string, or date character vector
To support existing code, cirtimespec
also
accepts serial date numbers as inputs, but they are not recommended.
Maturity
— Date marking the depth of tree
datetime scalar | string scalar | date character vector
Date marking the depth of the tree, specified as a scalar datetime, string, or date character vector.
To support existing code, cirtimespec
also
accepts serial date numbers as inputs, but they are not recommended.
NumPeriods
— Determines how many time steps are in tree
nonnegative integer
Determines how many time steps are in tree, specified as a scalar using a nonnegative integer value.
Data Types: double
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: TimeSpec =
cirtimespec(Valuationdate,Maturity,NumPeriods,'Basis',3)
Compounding
— Frequency at which the rates are compounded when annualized
1
(default) | integer with value of 1
, 2
, 3
, 4
, 6
, or 12
Frequency at which the rates are compounded when annualized, specified as the
comma-separated pair consisting of 'Compounding'
and a scalar value:
1
— Annual compounding2
— Semiannual compounding3
— Compounding three times per year4
— Quarterly compounding6
— Bimonthly compounding12
— Monthly compounding
Data Types: double
Basis
— Day count basis
0
(actual/actual) (default) | integer from 0
to 13
Day count basis, specified as the comma-separated pair consisting of
'Basis'
and a scalar value:
0 = actual/actual
1 = 30/360 (SIA)
2 = actual/360
3 = actual/365
4 = 30/360 (PSA)
5 = 30/360 (ISDA)
6 = 30/360 (European)
7 = actual/365 (Japanese)
8 = actual/actual (ICMA)
9 = actual/360 (ICMA)
10 = actual/365 (ICMA)
11 = 30/360E (ICMA)
12 = actual/365 (ISDA)
13 = BUS/252
For more information, see Basis.
Data Types: double
EndMonthRule
— End-of-month rule flag for generating dates when Maturity
is end-of-month date for month having 30 or fewer days
1
(in effect) (default) | nonnegative integer [0,1]
End-of-month rule flag for generating dates when Maturity
is
an end-of-month date for a month having 30 or fewer days, specified as the
comma-separated pair consisting of 'EndMonthRule'
and a nonnegative
integer [0
, 1
] using a scalar.
0
= Ignore rule, meaning that a payment date is always the same numerical day of the month.1
= Set rule on, meaning that a payment date is always the last actual day of the month.
Data Types: logical
Output Arguments
TimeSpec
— Time layout for CIR tree
structure
Time layout for the CIRTree
, returned as a structure.
Version History
Introduced in R2018aR2022b: Serial date numbers not recommended
Although cirtimespec
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 (한국어)