# optstocksensbybaw

Calculate American options prices and sensitivities using Barone-Adesi and Whaley option pricing model

## Syntax

## Description

## Examples

### Compute an American Option Price and Sensitivities Using the Barone-Adesi and Whaley Option Pricing Model

Consider an American call option with an exercise price of $120. The option expires on Jan 1, 2018. The stock has a volatility of 14% per annum, and the annualized continuously compounded risk-free rate is 4% per annum as of Jan 1, 2016. Using this data, calculate the price of the American call, assuming the price of the stock is $125 and pays a dividend of 2%.

StartDate = datetime(2016,1,1); EndDate = datetime(2018,1,1); Basis = 1; Compounding = -1; Rates = 0.04;

Define the `RateSpec`

.

RateSpec = intenvset('ValuationDate',StartDate,'StartDate',StartDate,'EndDate',EndDate, ... 'Rates',Rates,'Basis',Basis,'Compounding',Compounding)

`RateSpec = `*struct with fields:*
FinObj: 'RateSpec'
Compounding: -1
Disc: 0.9231
Rates: 0.0400
EndTimes: 2
StartTimes: 0
EndDates: 737061
StartDates: 736330
ValuationDate: 736330
Basis: 1
EndMonthRule: 1

Define the `StockSpec`

.

```
Dividend = 0.02;
AssetPrice = 125;
Volatility = 0.14;
StockSpec = stockspec(Volatility,AssetPrice,'Continuous',Dividend)
```

`StockSpec = `*struct with fields:*
FinObj: 'StockSpec'
Sigma: 0.1400
AssetPrice: 125
DividendType: {'continuous'}
DividendAmounts: 0.0200
ExDividendDates: []

Define the American option.

```
OptSpec = 'call';
Strike = 120;
Settle = datetime(2016,1,1);
Maturity = datetime(2018,1,1);
```

Compute the price and sensitivities for the American option.

OutSpec = {'price';'delta';'theta'}; [Price,Delta,Theta] = optstocksensbybaw(RateSpec,StockSpec,Settle,Maturity,OptSpec,Strike,'OutSpec',OutSpec)

Price = 14.5180

Delta = 0.6672

Theta = -3.1861

## 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, `optstocksensbybaw`

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, `optstocksensbybaw`

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: **`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: **`[Price,Delta,Theta] = optstocksensbybaw(RateSpec,StockSpec,Settle,Maturity,OptSpec,Strike,'OutSpec',OutSpec)`

`OutSpec`

— Define outputs

`{'Price'}`

(default) | character vector with values `'Price'`

, `'Delta'`

, `'Gamma'`

, `'Vega'`

, `'Lambda'`

, `'Rho'`

, `'Theta'`

,
and `'All'`

| cell array of character vectors with values `'Price'`

, `'Delta'`

, `'Gamma'`

, `'Vega'`

, `'Lambda'`

, `'Rho'`

, `'Theta'`

,
and `'All'`

Define outputs, specified as the comma-separated pair consisting
of `'OutSpec'`

and a `NOUT`

- by-`1`

or
a `1`

-by-`NOUT`

cell array of character
vectors with possible values of `'Price'`

, `'Delta'`

, `'Gamma'`

, `'Vega'`

, `'Lambda'`

, `'Rho'`

, `'Theta'`

,
and `'All'`

.

`OutSpec = {'All'}`

specifies that the output
is `Delta`

, `Gamma`

, `Vega`

, `Lambda`

, `Rho`

, `Theta`

,
and `Price`

, in that order. This is the same as specifying `OutSpec`

to
include each sensitivity.

**Example: **`OutSpec = {'delta','gamma','vega','lambda','rho','theta','price'}`

**Data Types: **`char`

| `cell`

## Output Arguments

`PriceSens`

— Expected prices or sensitivities for American options

matrix

Expected prices or sensitivities for American options, returned
as a `NINST`

-by-`1`

matrix.

**Note**

All sensitivities are evaluated by computing a discrete approximation of the partial derivative. This means that the option is revalued with a fractional change for each relevant parameter. The change in the option value divided by the increment is the approximated sensitivity value.

## 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: $$\mathrm{max}(St-K,0)$$

For a put: $$\mathrm{max}(K-St,0)$$

where:

*St* is the price of the underlying asset at time
*t*.

*K* is the strike price.

For more information, see Vanilla Option.

## References

[1] Barone-Aclesi, 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 `optstocksensbybaw`

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.

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## 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)