# impvbybaw

Calculate implied volatility using Barone-Adesi and Whaley option pricing model

## Syntax

## Description

adds
optional name-value pair arguments.`Volatility`

= impvbybaw(___,`Name,Value`

)

## Examples

### Compute the Implied Volatility for an American Option Using the Barone-Adesi and Whaley Option Pricing Model

This example shows how to compute implied volatility using the Barone-Adesi and Whaley option pricing model. Consider three American call options with exercise prices of $100 that expire on July 1, 2017. The underlying stock is trading at $100 on January 1, 2017 and pays a continuous dividend yield of 10%. The annualized continuously compounded risk-free rate is 10% per annum, and the option prices are $4.063, $6.77 and $9.46. Using this data, calculate the implied volatility of the stock using the Barone-Adesi and Whaley option pricing model.

AssetPrice = 100; Settle = datetime(2017,1,1); Maturity = datetime(2017,6,1); Strike = 100; DivAmount = 0.1; Rate = 0.05;

Define the `RateSpec`

.

RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle,... 'EndDates', Maturity, 'Rates', Rate, 'Compounding', -1, 'Basis', 1)

`RateSpec = `*struct with fields:*
FinObj: 'RateSpec'
Compounding: -1
Disc: 0.9794
Rates: 0.0500
EndTimes: 0.4167
StartTimes: 0
EndDates: 736847
StartDates: 736696
ValuationDate: 736696
Basis: 1
EndMonthRule: 1

Define the `StockSpec`

.

`StockSpec = stockspec(NaN, AssetPrice, {'continuous'}, DivAmount)`

`StockSpec = `*struct with fields:*
FinObj: 'StockSpec'
Sigma: NaN
AssetPrice: 100
DividendType: {'continuous'}
DividendAmounts: 0.1000
ExDividendDates: []

Define the American option.

```
OptSpec = {'call'};
OptionPrice = [4.063;6.77;9.46];
```

Compute the implied volatility for the American option.

```
ImpVol = impvbybaw(RateSpec, StockSpec, Settle, Maturity, OptSpec,...
Strike, OptionPrice)
```

`ImpVol = `*3×1*
0.1916
0.3010
0.4093

## 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 for the American option, specified as a
`NINST`

-by-`1`

vector using a datetime
array, string array, or date character vectors.

To support existing code, `impvbybaw`

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 American option, specified as a
`NINST`

-by-`1`

vector using a datetime
array, string array, or date character vectors.

To support existing code, `impvbybaw`

also
accepts serial date numbers as inputs, but they are not recommended.

`OptSpec`

— Definition of option

character vector with values `'call'`

or
`'put'`

| string array with values `'call'`

or
`'put'`

Definition of the option as `'call'`

or `'put'`

, specified
as a `NINST`

-by-`1`

cell array of character vectors
or string arrays with values `'call'`

or
`'put'`

.

**Data Types: **`char`

| `string`

`Strike`

— American option strike price value

nonnegative scalar | nonnegative vector

American option strike price value, specified as a nonnegative
scalar or `NINST`

-by-`1`

matrix
of strike price values. Each row is the schedule for one option.

**Data Types: **`single`

| `double`

`OptPrice`

— American option price

nonnegative scalar | nonnegative vector

American option prices from which the implied volatility of
the underlying asset is derived, specified as a nonnegative scalar
or `NINST`

-by-`1`

matrix of strike
price values.

**Data Types: **`single`

| `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 = impvbybaw(RateSpec,StockSpec,Settle,Maturity,OptSpec,Strike,OptionPrice)`

`Limit`

— Lower and upper bound of implied volatility search interval

`[0.1 10]`

(or 10% to 1000%
per annum) (default) | positive value

Lower and upper bound of implied volatility search interval,
specified as the comma-separated pair consisting of `'Limit'`

and
a `1`

-by-`2`

positive vector.

**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.

**Data Types: **`double`

## Output Arguments

`Volatility`

— Expected implied volatility values

matrix

Expected implied volatility values, returned as a `NINST`

-by-`1`

matrix.
If no solution can be found, a `NaN`

is returned.

## References

[1] Barone-Adesi, G. and Robert E. Whaley. “Efficient Analytic Approximation of
American Option Values.” *The Journal of Finance.* Volume
42, Issue 2 (June 1987), 301–320.

[2] Haug, E. *The Complete Guide to Option Pricing Formulas.* *Second
Edition.* McGraw-Hill Education, January 2007.

## Version History

**Introduced in R2017a**

### R2022b: Serial date numbers not recommended

Although `impvbybaw`

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)