crrtimespec
Specify time structure for Cox-Ross-Rubinstein tree
Description
sets the number of levels and node times for a CRR binomial tree (TimeSpec
= crrtimespec(ValuationDate
,Maturity
,NumPeriods
)crrtree
).
Examples
Set the Number of Levels and Node Times for a CRR Binomial Tree
This example shows how to specify a four-period CRR tree with time steps of 1 year.
ValuationDate = datetime(2002,7,1); Maturity = datetime(2006,7,1); TimeSpec = crrtimespec(ValuationDate, Maturity, 4)
TimeSpec = struct with fields:
FinObj: 'BinTimeSpec'
ValuationDate: 731398
Maturity: 732859
NumPeriods: 4
Basis: 0
EndMonthRule: 1
tObs: [0 1 2 3 4]
dObs: [731398 731763 732128 732493 732859]
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 crrtree
, specified as a
scalar datetime, string, or date character vector.
To support existing code, crrtimespec
also
accepts serial date numbers as inputs, but they are not recommended.
Maturity
— Date marking the depth of the CRR stock tree
datetime scalar | string scalar | date character vector
Date marking the depth of the crrtree
binomial tree,
specified as scalar datetime, string, or date character vector.
To support existing code, crrtimespec
also
accepts serial date numbers as inputs, but they are not recommended.
NumPeriods
— Number of time steps in the CRR stock tree
integer
Number of time steps in the crrtree
binomial tree,
specified as scalar integer value.
Data Types: double
Output Arguments
TimeSpec
— Specification for the time layout for crrtree
structure
Specification for the time layout for crrtree
, returned as a
structure.
Version History
Introduced before R2006aR2022b: Serial date numbers not recommended
Although crrtimespec
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-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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)