stockoptspec
Specify European stock option structure
Syntax
Description
creates a structure encapsulating the properties of a stock option structure.StockOptSpec
= stockoptspec(OptPrice
,Strike
,Settle
,Maturity
,OptSpec
,InterpMethod
)
specifies options using one or more optional arguments in addition to the input
arguments in the previous syntax.StockOptSpec
= stockoptspec(___,InterpMethod
)
Examples
Specify a European Stock Option Structure
This example shows how to specify a European stock option structure using the following data quoted from liquid options in the market with varying strikes and maturity.
Settle = datetime(2006,1,1); Maturity = [datetime(2006,7,1) ; datetime(2006,7,1) ; datetime(2006,7,1) ; datetime(2006,7,1) ; datetime(2007,1,1) ; datetime(2007,1,1) ; datetime(2007,1,1) ; datetime(2007,1,1) ; datetime(2007,7,1) ; datetime(2007,7,1) ; datetime(2007,7,1) ; datetime(2007,7,1) ; datetime(2008,1,1) ; datetime(2008,1,1) ; datetime(2008,1,1) ; datetime(2008,1,1)]; Strike = [113; 101; 100; 88; 128; 112; 100; 78; 144; 112; 100; 69; 162; 112; 100; 61]; OptPrice =[ 0; 4.807905472659144; 1.306321897011867; 0.048039195057173; 0; 2.310953054191461; 1.421950392866235; 0.020414826276740; 0; 5.091986935627730; 1.346534812295291; 0.005101325584140; 0; 8.047628153217246; 1.219653432150932; 0.001041436654748]; OptSpec = { 'call'; 'call'; 'put'; 'put'; 'call'; 'call'; 'put'; 'put'; 'call'; 'call'; 'put'; 'put'; 'call'; 'call'; 'put'; 'put'}; StockOptSpec = stockoptspec(OptPrice, Strike, Settle, Maturity, OptSpec)
StockOptSpec = struct with fields:
FinObj: 'StockOptSpec'
OptPrice: [16x1 double]
Strike: [16x1 double]
Settle: 732678
Maturity: [16x1 double]
OptSpec: {16x1 cell}
InterpMethod: 'price'
Input Arguments
OptPrice
— European option prices
vector
European option prices, specified as an
NINST
-by-1
vector.
Data Types: double
Strike
— Strike prices
vector
Strike prices, specified as an
NINST
-by-1
vector.
Data Types: double
Settle
— Settlement date
datetime scalar | string scalar | date character vector
Settlement date, specified as a scalar datetime, string, or date character vector.
To support existing code, stockoptspec
also
accepts serial date numbers as inputs, but they are not recommended.
Maturity
— Maturity dates
datetime array | string array | date character vector
Maturity dates, specified as an
NINST
-by-1
vector using a datetime
array, string array, or date character vectors.
To support existing code, stockoptspec
also
accepts serial date numbers as inputs, but they are not recommended.
OptSpec
— Option type
cell array of character vectors with a value of 'call'
or 'put'
Option type, specified as an
NINST
-by-1
cell array of character
vectors with a value of 'call'
or
'put'
.
Data Types: cell
InterpMethod
— Interpolation method for option prices
'price'
(default) | scalar character vector with value of 'price'
or 'vol'
(Optional) Interpolation method for option prices, specified as a scalar character vector with one of the following values:
'price'
indicates that prices are used for interpolation purposes.'vol'
indicates that implied volatilities are used for interpolation purposes. The interpolated values are then used to calculate the implicit interpolated prices.
.
Data Types: char
Output Arguments
StockOptSpec
— Structure encapsulating the properties of a stock options structure
structure
Structure encapsulating the properties of a stock options structure, returned as a structure.
Version History
Introduced in R2007aR2022b: Serial date numbers not recommended
Although stockoptspec
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)