stttimespec
Specify time structure for standard trinomial tree
Description
creates
a time spec for a standard trinomial (STT) tree.TimeSpec
= stttimespec(ValuationDate
,Maturity
,NumPeriods
)
Examples
Create a stttimespec to Build a STTTree
Create a RateSpec
.
StartDates = datetime(2014,1,1); EndDates = datetime(2018,1,1); Rates = 0.025; Basis = 1; Compounding = -1; RateSpec = intenvset('ValuationDate', StartDates, 'StartDates', StartDates,'EndDates',... EndDates, 'Rates', Rates,'Compounding', Compounding, 'Basis', Basis)
RateSpec = struct with fields:
FinObj: 'RateSpec'
Compounding: -1
Disc: 0.9048
Rates: 0.0250
EndTimes: 4
StartTimes: 0
EndDates: 737061
StartDates: 735600
ValuationDate: 735600
Basis: 1
EndMonthRule: 1
Create a StockSpec
.
AssetPrice = 110;
Sigma = 0.22;
Div = 0.02;
StockSpec = stockspec(Sigma, AssetPrice, 'continuous', Div)
StockSpec = struct with fields:
FinObj: 'StockSpec'
Sigma: 0.2200
AssetPrice: 110
DividendType: {'continuous'}
DividendAmounts: 0.0200
ExDividendDates: []
Create a STTTimespec
and STTTree
.
NumPeriods = length(cfdates(StartDates,EndDates,12)); TimeSpec = stttimespec(StartDates, EndDates, NumPeriods)
TimeSpec = struct with fields:
FinObj: 'STTTimeSpec'
ValuationDate: 735600
Maturity: 737061
NumPeriods: 48
Basis: 0
EndMonthRule: 1
tObs: [0 0.0833 0.1667 0.2500 0.3333 0.4167 0.5000 0.5833 0.6667 0.7500 0.8333 0.9167 1 1.0833 1.1667 1.2500 1.3333 1.4167 1.5000 1.5833 1.6667 1.7500 1.8333 1.9167 2 2.0833 2.1667 2.2500 2.3333 2.4167 2.5000 2.5833 2.6667 ... ] (1x49 double)
dObs: [735600 735630 735660 735691 735721 735752 735782 735813 735843 735873 735904 735934 735965 735995 736026 736056 736087 736117 736147 736178 736208 736239 736269 736300 736330 736360 736391 736421 736452 736482 ... ] (1x49 double)
STTT = stttree(StockSpec, RateSpec, TimeSpec)
STTT = struct with fields:
FinObj: 'STStockTree'
StockSpec: [1x1 struct]
TimeSpec: [1x1 struct]
RateSpec: [1x1 struct]
tObs: [0 0.0833 0.1667 0.2500 0.3333 0.4167 0.5000 0.5833 0.6667 0.7500 0.8333 0.9167 1 1.0833 1.1667 1.2500 1.3333 1.4167 1.5000 1.5833 1.6667 1.7500 1.8333 1.9167 2 2.0833 2.1667 2.2500 2.3333 2.4167 2.5000 2.5833 2.6667 ... ] (1x49 double)
dObs: [735600 735630 735660 735691 735721 735752 735782 735813 735843 735873 735904 735934 735965 735995 736026 736056 736087 736117 736147 736178 736208 736239 736269 736300 736330 736360 736391 736421 736452 736482 736513 ... ] (1x49 double)
STree: {1x49 cell}
Probs: {1x48 cell}
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, stttimespec
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 using a scalar datetime, string, or date character vector.
To support existing code, stttimespec
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
Output Arguments
TimeSpec
— Time layout for standard trinomial (STT) tree
structure
Time layout for standard trinomial (STT) tree, returned as a structure.
Version History
Introduced in R2015bR2022b: Serial date numbers not recommended
Although stttimespec
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.
See Also
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
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)