instoptstock
Construct stock option
Syntax
Description
creates a new instrument set containing stock option instruments.InstSet
= instoptstock(OptSpec
,Strike
,Settle
,ExerciseDates
)
adds an optional argument for InstSet
= instoptstock(___,AmericanOpt
)AmericanOpt
.
[
lists field meta-data for the stock option instrument.FieldList
,ClassList
,TypeString
] = instoptstock
Examples
Create a Stock Option Instrument
Create an instrument set of two stock options with the following data:
OptSpec = {'put';'call'}; Strike = [95;98]; Settle = datetime(2012,5,1); ExerciseDates = [datetime(2014,5,1) ; datetime(2015,5,1)]; AmericanOpt = [0;1];
Create the stock option instruments.
InstSet = instoptstock(OptSpec, Strike,Settle, ExerciseDates, AmericanOpt)
InstSet = struct with fields:
FinObj: 'Instruments'
IndexTable: [1x1 struct]
Type: {'OptStock'}
FieldName: {{1x1 cell}}
FieldClass: {{1x1 cell}}
FieldData: {{1x1 cell}}
Display the instrument set.
instdisp(InstSet)
Index Type OptSpec Strike Settle ExerciseDates AmericanOpt 1 OptStock put 95 01-May-2012 01-May-2014 0 2 OptStock call 98 01-May-2012 01-May-2015 1
Input Arguments
InstSet
— Instrument variable
structure
Instrument variable, specified only when adding stock option instruments
to an existing instrument set. For more information on the
InstSet
variable, see instget
.
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 a scalar 'call'
or
'put'
or an
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 scalar or an
NINST
-by-1
or an
NINST
-by-NSTRIKES
depending on the
option type:
For a European option, use an
NINST
-by-1
vector of strike prices.For a Bermuda option, use an
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 an
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 scalar or an
NINST
-by-1
vector using a datetime
array, string array, or date character vectors.
To support existing code, instoptstock
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 scalar or an
NINST
-by-1
,NINST
-by-2
,
or an NINST
-by-NSTRIKES
vector using a
datetime array, string array, or date character vectors, depending on the
option type:
For a European option, use an
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 an
NINST
-by-NSTRIKES
vector of dates. Each row is the schedule for one option.For an American option, use an
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.
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, instoptstock
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 a scalar or an
NINST
-by-1
vector of integer flags
with values:
0
— European or Bermuda1
— American
Data Types: double
Output Arguments
InstSet
— Variable containing a collection of instruments
structure
Variable containing a collection of instruments, returned as a structure.
Instruments are broken down by type and each type can have different data
fields. Each stored data field has a row vector or string for each
instrument. For more information on the InstSet
variable,
see instget
.
FieldList
— Name of each data field for stock option instrument
cell array of character vectors
Name of each data field for a stock option instrument, returned as an
NFIELDS
-by-1
cell array of
character vectors.
ClassList
— Data class for each field
cell array of character vectors
Data class for each field, returned as an
NFIELDS
-by-1
cell array of
character vectors. The class determines how arguments are parsed. Valid
character vectors are 'dble'
, 'date'
,
and 'char'
.
TypeString
— Type of instrument
character vector
Type of instrument, returned as a character vector. For a stock option
instrument, TypeString = 'OptStock'
.
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 instoptstock
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.
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)