optstockbycrr
Price stock option from Cox-Ross-Rubinstein tree
Syntax
Description
[
returns the price of a European, Bermuda, or American stock
option from a Cox-Ross-Rubinstein tree. Price
,PriceTree
]
= optstockbycrr(CRRTree
,OptSpec
,Strike
,Settle
,ExerciseDates
)
Note
Alternatively, you can use the Vanilla
object to price vanilla options.
For more information, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.
[
adds
an optional argument for Price
,PriceTree
]
= optstockbycrr(___,AmericanOpt
)AmericanOpt
.
Examples
Price an American Stock Option Using a CRR Binomial Tree
This example shows how to price an American stock option using a CRR binomial tree by loading the file deriv.mat
, which provides CRRTree
. The CRRTree
structure contains the stock specification and time information needed to price the American option.
load deriv.mat; OptSpec = 'Call'; Strike = 105; Settle = datetime(2003,1,1); ExerciseDates = datetime(2005,1,1); AmericanOpt = 1; Price = optstockbycrr(CRRTree, OptSpec, Strike, Settle, ... ExerciseDates, AmericanOpt)
Price = 8.2863
Price a Bermudan Stock Option Using a CRR Binomial Tree
Load the file deriv.mat
, which provides CRRTree
. The CRRTree
structure contains the stock specification and time information needed to price the Bermudan option.
load deriv.mat; % Option OptSpec = 'Call'; Strike = [110,111,112,113]
Strike = 1×4
110 111 112 113
Settle = datetime(2003,1,1); ExerciseDatesBerm= [datetime(2004,1,1) datetime(2005,1,1) datetime(2006,1,1) datetime(2007,1,1)];
Price the Bermudan option.
Price = optstockbycrr(CRRTree, OptSpec, Strike, Settle, ExerciseDatesBerm)
Price = 11.6017
Input Arguments
CRRTree
— Stock tree structure
structure
Stock tree structure, specified by using crrtree
.
Data Types: struct
OptSpec
— Definition of option
character vector with value 'call'
or 'put'
| cell array of character vectors with values 'call'
or 'put'
Definition of option, specified as 'call'
or 'put'
using
a NINST
-by-1
cell array of character
vectors.
Data Types: char
| cell
Strike
— Option strike price values
nonnegative integer
Option strike price value, specified with a NINST
-by-1
or NINST
-by-NSTRIKES
depending
on the option type:
For a European option, use a
NINST
-by-1
vector of strike prices.For a Bermuda option, use a
NINST
-by-NSTRIKES
matrix of strike prices. Each row is the schedule for one option. If an option has fewer thanNSTRIKES
exercise opportunities, the end of the row is padded withNaN
s.For an American option, use a
NINST
-by-1
of strike prices.
Note
The interpretation of the Strike
and ExerciseDates
arguments
depends upon the setting of the AmericanOpt
argument.
If AmericanOpt = 0
, NaN
, or
is unspecified, the option is a European or Bermuda option. If AmericanOpt
= 1
, the option is an American option.
Data Types: double
Settle
— Settlement date or trade date
datetime array | string array | date character vector
Settlement date or trade date, specified as a NINST
-by-1
vector using a datetime array, string array, or date
character vectors.
Note
The Settle
date for every
option is set to the
ValuationDate
of the stock
tree. The option argument
Settle
is ignored.
To support existing code, optstockbycrr
also
accepts serial date numbers as inputs, but they are not recommended.
ExerciseDates
— Option exercise dates
datetime array | string array | date character vector
Option exercise dates, specified as a
NINST
-by-1
,NINST
-by-2
,
or
NINST
-by-NSTRIKES
vector using a datetime array, string array, or date
character vectors, depending on the option type:
For a European option, use a
NINST
-by-1
vector of dates. Each row is the schedule for one option. For a European option, there is only oneExerciseDates
on the option expiry date.For a Bermuda option, use a
NINST
-by-NSTRIKES
vector of dates. Each row is the schedule for one option.For an American option, use a
NINST
-by-2
vector of exercise date boundaries. The option can be exercised on any date between or including the pair of dates on that row. If only one non-NaN
date is listed, or ifExerciseDates
is aNINST
-by-1
vector, the option can be exercised betweenValuationDate
of the stock tree and the single listedExerciseDates
.
Note
The interpretation of the
Strike
and
ExerciseDates
arguments depends
upon the setting of the
AmericanOpt
argument. If
AmericanOpt = 0
,
NaN
, or is unspecified, the
option is a European or Bermuda option. If
AmericanOpt = 1
, the option is
an American option.
To support existing code, optstockbycrr
also
accepts serial date numbers as inputs, but they are not recommended.
AmericanOpt
— Option type
0
European or Bermuda (default) | integer with values of 0
or 1
(Optional) Option type, specified as NINST
-by-1
vector
of integer flags with values:
0
— European or Bermuda1
— American
Data Types: double
Output Arguments
Price
— Expected price of option at time 0
vector
Expected price of the vanilla option at time 0
,
returned as a NINST
-by-1
vector.
PriceTree
— Structure containing trees of vectors of instrument prices for each node
structure
Structure containing trees of vectors of instrument prices and a vector of observation times for each node. Values are:
PriceTree.PTree
contains the clean prices.PriceTree.tObs
contains the observation times.PriceTree.dObs
contains the observation dates.
More About
Vanilla Option
A vanilla option is a category of options that includes only the most standard components.
A vanilla option has an expiration date and straightforward strike price. American-style options and European-style options are both categorized as vanilla options.
The payoff for a vanilla option is as follows:
For a call:
For a put:
where:
St is the price of the underlying asset at time t.
K is the strike price.
For more information, see Vanilla Option.
Version History
Introduced before R2006aR2022b: Serial date numbers not recommended
Although optstockbycrr
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
crrtree
| instoptstock
| Vanilla
Topics
- Computing Prices Using CRR
- Examining Output from the Pricing Functions
- Computing Equity Instrument Sensitivities
- Graphical Representation of Equity Derivative Trees
- Price European Vanilla Call Options Using Black-Scholes Model and Different Equity Pricers
- Vanilla Option
- Computing Instrument Prices
- Supported Equity Derivative Functions
- Mapping Financial Instruments Toolbox Functions for Equity, Commodity, FX Instrument Objects
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)