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
Price a Compound Option Using the Standard Trinomial Tree Model
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: [1x1 struct]
TimeSpec: [1x1 struct]
RateSpec: [1x1 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: {[3x1 double] [3x3 double] [3x5 double] [3x7 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
STTTree
— Stock tree structure for standard trinomial tree
structure
Stock tree structure for standard trinomial tree, specified
by using stttree
.
Data Types: struct
UOptSpec
— Definition of underlying option
character vector with value 'call'
or 'put'
Definition of underlying option, specified as 'call'
or 'put'
using
a character vector.
Data Types: char
UStrike
— Underlying option strike price value
nonnegative integer
Underlying option strike price value, specified with a nonnegative
integer using a 1
-by-1
vector.
Data Types: double
USettle
— Underlying option settlement date or trade date
datetime array | string array | date character vector
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.
UExerciseDates
— Underlying option exercise date
datetime array | string array | date character vector
Underlying option exercise date, specified as a datetime array, string array, or date character vectors:
For a European option, use a
1
-by-1
vector of the underlying exercise date. For a European option, there is only oneExerciseDates
on the option expiry date.For an American option, use a
1
-by-2
vector of the underlying exercise date boundaries. The option can be exercised on any tree date. If only one non-NaN
date is listed, or ifExerciseDates
is1
-by-1
, the option can be exercised betweenValuationDate
of the stock tree and the single listedExerciseDates
.
To support existing code, compoundbystt
also
accepts serial date numbers as inputs, but they are not recommended.
UAmericanOpt
— Underlying option type
0
European (default) | scalar with values 0
or 1
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
COptSpec
— Definition of compound option
character vector with value 'call'
or 'put'
| cell array of character vectors with values 'call'
or 'put'
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
CStrike
— Compound option strike price values
nonnegative integers
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
CSettle
— Compound option settlement date or trade date
datetime array | string array | date character vector
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.
CExerciseDates
— Compound option exercise dates
datetime array | string array | date character vector
Compound option exercise dates, specified as a datetime array, string array, or date character vectors:
For a European option, use a
NINST
-by-1
matrix of the compound exercise dates. Each row is the schedule for one option. For a European option, there is only oneExerciseDates
on the option expiry date.For an American option, use a
NINST
-by-2
vector 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-NaN
date is listed, or ifExerciseDates
isNINST
-by-1
, the option can be exercised betweenValuationDate
of 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)
CAmericanOpt
— Compound option type
0
European (default) | scalar with values [0,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
Price
— Expected prices for compound options at time 0
vector
Expected prices for compound options at time 0, returned as
a NINST
-by-1
vector.
PriceTree
— Structure with vector of compound option prices at each node
tree structure
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
Compound Option
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 R2015bR2022b: Serial date numbers not recommended
Although 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.
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)