compoundbystt
Price compound options using standard trinomial tree
Syntax
Description
[ prices
compound options using a standard trinomial (STT) tree.Price,PriceTree]
= compoundbystt(STTTree,UOptSpec,UStrike,USettle,UExerciseDates,UAmericanOpt,COptSpec,CStrike,CSettle,CExerciseDates)
[ adds
an optional name-value pair argument for Price,PriceTree]
= compoundbystt(___,Name,Value)CAmericanOpt.
Examples
Create a RateSpec.
StartDates = datetime(2009,1,1); EndDates = datetime(2013,1,1); Rates = 0.035; 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.8694
Rates: 0.0350
EndTimes: 4
StartTimes: 0
EndDates: 735235
StartDates: 733774
ValuationDate: 733774
Basis: 1
EndMonthRule: 1
Create a StockSpec.
AssetPrice = 85; Sigma = 0.15; StockSpec = stockspec(Sigma, AssetPrice)
StockSpec = struct with fields:
FinObj: 'StockSpec'
Sigma: 0.1500
AssetPrice: 85
DividendType: []
DividendAmounts: 0
ExDividendDates: []
Create an STTTree.
NumPeriods = 4; TimeSpec = stttimespec(StartDates, EndDates, 4); STTTree = stttree(StockSpec, RateSpec, TimeSpec)
STTTree = struct with fields:
FinObj: 'STStockTree'
StockSpec: [1×1 struct]
TimeSpec: [1×1 struct]
RateSpec: [1×1 struct]
tObs: [0 1 2 3 4]
dObs: [733774 734139 734504 734869 735235]
STree: {[85] [110.2179 85 65.5520] [142.9174 110.2179 85 65.5520 50.5537] [185.3182 142.9174 110.2179 85 65.5520 50.5537 38.9870] [240.2985 185.3182 142.9174 110.2179 85 65.5520 50.5537 38.9870 30.0668]}
Probs: {[3×1 double] [3×3 double] [3×5 double] [3×7 double]}
Define the compound option and compute the price.
USettle = datetime(2009,1,1); UExerciseDates = datetime(2012,1,1); UOptSpec = 'call'; UStrike = 95; UAmericanOpt = 1; CSettle = datetime(2009,1,1); CExerciseDates = datetime(2011,1,1); COptSpec = 'put'; CStrike = 5; CAmericanOpt = 1; Price= compoundbystt(STTTree, UOptSpec, UStrike, USettle, UExerciseDates,... UAmericanOpt, COptSpec, CStrike, CSettle,CExerciseDates, CAmericanOpt)
Price = 1.7090
Input Arguments
Stock tree structure for standard trinomial tree, specified
by using stttree.
Data Types: struct
Definition of underlying option, specified as 'call' or 'put' using
a character vector.
Data Types: char
Underlying option strike price value, specified with a nonnegative
integer using a 1-by-1 vector.
Data Types: double
Underlying option settlement date or trade date, specified as a
1-by-1 vector using a datetime
array, string array, or date character vectors.
To support existing code, compoundbystt also
accepts serial date numbers as inputs, but they are not recommended.
Underlying option exercise date, specified as a datetime array, string array, or date character vectors:
For a European option, use a
1-by-1vector of the underlying exercise date. For a European option, there is only oneExerciseDateson the option expiry date.For an American option, use a
1-by-2vector of the underlying exercise date boundaries. The option can be exercised on any tree date. If only one non-NaNdate is listed, or ifExerciseDatesis1-by-1, the option can be exercised betweenValuationDateof the stock tree and the single listedExerciseDates.
To support existing code, compoundbystt also
accepts serial date numbers as inputs, but they are not recommended.
Underlying option type, specified as NINST-by-1 positive
integer scalar flags with values:
0— European1— American
If UAmericanOpt is a NaN or
is unspecified, the option is a European option.
Data Types: single | double
Definition of compound option, specified as 'call' or 'put' using
a character vector or a cell array of character vectors with values 'call' or 'put'.
Data Types: char | cell
Compound option strike price values for a European and American
option, specified with a nonnegative integer using a NINST-by-1 matrix.
Each row is the schedule for one option.
Data Types: double
Compound option settlement date or trade date, specified as a
1-by-1 vector using a datetime
array, string array, or date character vectors.
To support existing code, compoundbystt also
accepts serial date numbers as inputs, but they are not recommended.
Compound option exercise dates, specified as a datetime array, string array, or date character vectors:
For a European option, use a
NINST-by-1matrix of the compound exercise dates. Each row is the schedule for one option. For a European option, there is only oneExerciseDateson the option expiry date.For an American option, use a
NINST-by-2vector of the compound exercise date boundaries. For each instrument, the option can be exercised on any tree date between or including the pair of dates on that row. If only one non-NaNdate is listed, or ifExerciseDatesisNINST-by-1, the option can be exercised betweenValuationDateof the stock tree and the single listedExerciseDates.
To support existing code, compoundbystt also
accepts serial date numbers as inputs, but they are not recommended.
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: Price = compoundbystt(STTTree,UOptSpec,UStrike,USettle,UExerciseDates,UAmericanOpt,COptSpec,CStrike,CSettle,CExerciseDates,'CAmericanOpt',1)
Compound option type, specified as the comma-separated pair consisting of
'CAmericanOpt' and a
NINST-by-1 positive integer
scalar flags with values:
0— European1— American
Data Types: single | double
Output Arguments
Expected prices for compound options at time 0, returned as
a NINST-by-1 vector.
Structure with a vector of compound option prices at each node, returned as a tree structure.
PriceTree is a MATLAB® structure of trees
containing vectors of instrument prices and a vector of observation
times for each node.
PriceTree.PTree contains the prices.
PriceTree.tObs contains the observation times.
PriceTree.dObs contains the observation dates.
More About
A compound option is basically an option on an option; it gives the holder the right to buy or sell another option.
With a compound option, a vanilla stock option serves as the underlying instrument. Compound options thus have two strike prices and two exercise dates. For more information, see Compound Option.
Version History
Introduced in R2015bAlthough compoundbystt 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
stttimespec | stttree | sttprice | sttsens | instcompound
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)