impvbybls
Determine implied volatility using Black-Scholes option pricing model
Syntax
Description
specifies options using one or more name-value pair arguments in addition to the input
arguments in the previous syntax.Volatility
= impvbybls(___,Name,Value
)
Examples
Compute the Implied Volatility Using the Black-Scholes Option Pricing Model
This example shows how to compute the implied volatility using the Black-Scholes option pricing model. Consider a European call and put options with an exercise price of $40 that expires on June 1, 2008. The underlying stock is trading at $45 on January 1, 2008 and the risk-free rate is 5% per annum. The option price is $7.10 for the call and $2.85 for the put. Using this data, calculate the implied volatility of the European call and put using the Black-Scholes option pricing model.
AssetPrice = 45; Settlement = 'Jan-01-2008'; Maturity = 'June-01-2008'; Strike = 40; Rates = 0.05; OptionPrice = [7.10; 2.85]; OptSpec = {'call';'put'}; % define the RateSpec and StockSpec RateSpec = intenvset('ValuationDate', Settlement, 'StartDates', Settlement,... 'EndDates', Maturity, 'Rates', Rates, 'Compounding', -1, 'Basis', 1); StockSpec = stockspec(NaN, AssetPrice); ImpvVol = impvbybls(RateSpec, StockSpec, Settlement, Maturity, OptSpec,... Strike, OptionPrice,'Method','jackel2016')
ImpvVol = 2×1
0.3175
0.4878
The implied volatility is 31.75% for the call and 48.78% for the put.
Input Arguments
StockSpec
— Stock specification for underlying asset
structure
Stock specification for the underlying asset. For information
on the stock specification, see stockspec
.
stockspec
handles several
types of underlying assets. For example, for physical commodities
the price is StockSpec.Asset
, the volatility is StockSpec.Sigma
,
and the convenience yield is StockSpec.DividendAmounts
.
Data Types: struct
Settle
— Settlement date
datetime array | string array | date character vector
Settlement date, specified as a NINST
-by-1
vector using
a datetime array, string array, or date character vectors.
To support existing code, impvbybls
also
accepts serial date numbers as inputs, but they are not recommended.
Maturity
— Maturity date
datetime array | string array | date character vector
Maturity date for the European option, specified as a
NINST
-by-1
vector using a datetime array, string
array, or date character vectors.
To support existing code, impvbybls
also
accepts serial date numbers as inputs, but they are not recommended.
OptSpec
— Definition of option
character vector with values 'call'
or 'put'
Definition of the option from which the implied volatility is
derived, specified as a NINST
-by-1
cell
array of character vectors with a value of 'call'
or 'put'
.
Data Types: char
| cell
Strike
— Option strike price
nonnegative scalar | nonnegative vector
Option strike price value, specified as a nonnegative scalar or
NINST
-by-1
vector of strike prices. Each row is
the schedule for one option.
Data Types: double
OptPrice
— European option price
nonnegative scalar | nonnegative vector
European option prices from which the implied volatility of
the underlying asset is derived, specified as a nonnegative scalar
or NINST
-by-1
vector.
Data Types: double
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: Volatility = impvbybls(RateSpec,StockSpec,Settle,Maturity,OptSpec,Strike,OptPrice,'Limit',5,'Tolerance',1e-5)
Limit
— Upper bound of implied volatility search interval
10
(1000% per annum) (default) | positive value
Upper bound of implied volatility search interval, specified as the comma-separated pair
consisting of 'Limit'
and a positive scalar.
Note
If you are using Method
with a value of
'jackel2016'
, the Limit
argument is
ignored.
Data Types: double
Tolerance
— Implied volatility search termination tolerance
1e-6
(default) | positive scalar
Implied volatility search termination tolerance, specified as the comma-separated pair
consisting of 'Tolerance'
and a positive scalar.
Note
If you are using Method
with a value of
'jackel2016'
, the Tolerance
argument is
ignored.
Data Types: double
Method
— Method for computing implied volatility
'jackel2016'
(default) | character vector with values 'search'
or 'jackel2016'
| string with values "search"
or "jackel2016"
Method for computing implied volatility, specified as the comma-separated pair
consisting of 'Method'
and a character vector with a value of
'search'
or 'jackel2016'
or a string with a value of
"search"
or "jackel2016"
.
Data Types: char
| string
Output Arguments
Volatility
— Expected implied volatility values
vector
Expected implied volatility values, returned as a NINST
-by-1
vector.
If no solution can be found, a NaN
is returned.
References
[1] Jäckel, Peter. "Let's Be Rational." Wilmott Magazine., January, 2015 (https://onlinelibrary.wiley.com/doi/abs/10.1002/wilm.10395).
Version History
Introduced in R2008bR2022b: Serial date numbers not recommended
Although impvbybls
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 (한국어)