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 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 … ] (1×49 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 … ] (1×49 double)
STTT = stttree(StockSpec, RateSpec, TimeSpec)
STTT = struct with fields:
FinObj: 'STStockTree'
StockSpec: [1×1 struct]
TimeSpec: [1×1 struct]
RateSpec: [1×1 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 … ] (1×49 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 … ] (1×49 double)
STree: {1×49 cell}
Probs: {1×48 cell}
Input Arguments
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.
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.
Determines how many time steps are in tree, specified as a scalar using a nonnegative integer value.
Data Types: double
Output Arguments
Time layout for standard trinomial (STT) tree, returned as a structure.
Version History
Introduced in R2015bAlthough 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
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)