# optstocksensbyblk

Determine option prices or sensitivities on futures and forwards using Black option pricing model

## Syntax

## Description

computes option prices on futures and forwards using the Black option pricing model. `PriceSens`

= optstocksensbyblk(`RateSpec`

,`StockSpec`

,`Settle`

,`Maturity`

,`OptSpec`

,`Strike`

)

**Note**

`optstocksensbyblk`

calculates option prices or sensitivities on
futures and forwards. If `ForwardMaturity`

is not passed, the
function calculates prices or sensitivities of future options. If
`ForwardMaturity`

is passed, the function computes prices or
sensitivities of forward options. This function handles several types of underlying
assets, for example, stocks and commodities. For more information on the underlying
asset specification, see `stockspec`

.

adds optional name-value pair arguments for `PriceSens`

= optstocksensbyblk(___,`Name,Value`

)`ForwardMaturity`

and
`OutSpec`

to compute option prices or sensitivities on forwards using
the Black option pricing model.

## Examples

### Compute Option Prices and Sensitivities on Futures Using the Black Pricing Model

This example shows how to compute option prices and sensitivities on futures using the Black pricing model. Consider a European put option on a futures contract with an exercise price of $60 that expires on June 30, 2008. On April 1, 2008 the underlying stock is trading at $58 and has a volatility of 9.5% per annum. The annualized continuously compounded risk-free rate is 5% per annum. Using this data, compute `delta`

, `gamma`

, and the `price`

of the put option.

AssetPrice = 58; Strike = 60; Sigma = .095; Rates = 0.05; Settle = datetime(2008,4,1); Maturity = datetime(2008,6,30); % define the RateSpec and StockSpec RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, 'EndDates',... Maturity, 'Rates', Rates, 'Compounding', -1, 'Basis', 1); StockSpec = stockspec(Sigma, AssetPrice); % define the options OptSpec = {'put'}; OutSpec = {'Delta','Gamma','Price'}; [Delta, Gamma, Price] = optstocksensbyblk(RateSpec, StockSpec, Settle,... Maturity, OptSpec, Strike,'OutSpec', OutSpec)

Delta = -0.7469

Gamma = 0.1130

Price = 2.3569

### Compute Forward Option Prices and Delta Sensitivities

This example shows how to compute option prices and sensitivities on forwards using the Black pricing model. Consider two European call options on the Brent Blend forward contract that expires on January 1, 2015. The options expire on October 1, 2014 and Dec 1, 2014 with an exercise price % of $120 and $150 respectively. Assume that on January 1, 2014 the forward price is at $107, the annualized continuously compounded risk-free rate is 3% per annum and volatility is 28% per annum. Using this data, compute the price and delta of the options.

Define the `RateSpec`

.

ValuationDate = datetime(2014,1,1); EndDates = datetime(2015,1,1); Rates = 0.03; Compounding = -1; Basis = 1; RateSpec = intenvset('ValuationDate', ValuationDate, 'StartDates', ... ValuationDate, 'EndDates', EndDates, 'Rates', Rates, ... 'Compounding', Compounding, 'Basis', Basis');

Define the `StockSpec`

.

AssetPrice = 107; Sigma = 0.28; StockSpec = stockspec(Sigma, AssetPrice);

Define the options.

Settle = datetime(2014,1,1); Maturity = [datetime(2014,10,1) ; datetime(2014,12,1)]; %Options maturity Strike = [120;150]; OptSpec = {'call'; 'call'};

Price the forward call options and return the `Delta`

sensitivities.

ForwardMaturity = 'Jan-1-2015'; % Forward contract maturity OutSpec = {'Delta'; 'Price'}; [Delta, Price] = optstocksensbyblk(RateSpec, StockSpec, Settle, Maturity, OptSpec, ... Strike, 'ForwardMaturity', ForwardMaturity, 'OutSpec', OutSpec)

`Delta = `*2×1*
0.3518
0.1262

`Price = `*2×1*
5.4808
1.6224

## 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 or trade date

datetime array | string array | date character vector

Settlement or trade date, specified as a
`NINST`

-by-`1`

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

To support existing code, `optstocksensbyblk`

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

`Maturity`

— Maturity date for option

datetime array | string array | date character vector

Maturity date for option, specified as a
`NINST`

-by-`1`

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

To support existing code, `optstocksensbyblk`

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

`OptSpec`

— Definition of option

cell array of character vectors with values `'call'`

or
`'put'`

Definition of the option as `'call'`

or `'put'`

,
specified as a `NINST`

-by-`1`

cell array of
character vectors with values `'call'`

or
`'put'`

.

**Data Types: **`char`

| `cell`

`Strike`

— Option strike price value

nonnegative vector

Option strike price value, specified as a nonnegative
`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: **```
[Delta,Gamma,Price] =
optstocksensbyblk(RateSpec,StockSpec,Settle,Maturity,OptSpec,Strike,'OutSpec',OutSpec)
```

`ForwardMaturity`

— Maturity date or delivery date of forward contract

`Maturity`

of option (default) | date character vector

Maturity date or delivery date of forward contract, specified as the
comma-separated pair consisting of `'ForwardMaturity'`

and a
`NINST`

-by-`1`

vector using date character
vectors.

To support existing code, `optstocksensbyblk`

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

`OutSpec`

— Define outputs

`{'Price'}`

(default) | 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 `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 should be
`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 future prices or sensitivities values

vector

Expected future prices or sensitivities values, returned as a
`NINST`

-by-`1`

vector.

**Data Types: **`double`

## More About

### Futures Option

A *futures option* is a standardized contract
between two parties to buy or sell a specified asset of standardized quantity and quality
for a price agreed upon today (the futures price) with delivery and payment occurring at a
specified future date, the delivery date.

The futures contracts are negotiated at a futures exchange, which acts as an intermediary between the two parties. The party agreeing to buy the underlying asset in the future, the "buyer" of the contract, is said to be "long," and the party agreeing to sell the asset in the future, the "seller" of the contract, is said to be "short."

A futures contract is the delivery of item *J* at time
*T* and:

There exists in the market a quoted price $$F(t,T)$$, which is known as the futures price at time

*t*for delivery of*J*at time*T*.The price of entering a futures contract is equal to zero.

During any time interval [

*t*,*s*], the holder receives the amount $$F(s,T)-F(t,T)$$ (this reflects instantaneous marking to market).At time

*T*, the holder pays $$F(T,T)$$ and is entitled to receive*J*. Note that $$F(T,T)$$ should be the spot price of*J*at time*T*.

For more information, see Futures Option.

### Forwards Option

A *forwards option* is a non-standardized contract
between two parties to buy or to sell an asset at a specified future time at a price agreed
upon today.

The buyer of a forwards option contract has the right to hold a particular forward position at a specific price any time before the option expires. The forwards option seller holds the opposite forward position when the buyer exercises the option. A call option is the right to enter into a long forward position and a put option is the right to enter into a short forward position. A closely related contract is a futures contract. A forward is like a futures in that it specifies the exchange of goods for a specified price at a specified future date.

The payoff for a forwards option, where the value of a forward position at maturity
depends on the relationship between the delivery price (*K*) and the
underlying price (*S** _{T}*) at that
time, is:

For a long position: $${f}_{T}={S}_{T}-K$$

For a short position: $${f}_{T}=K-{S}_{T}$$

For more information, see Forwards Option.

## Version History

**Introduced in R2008b**

### R2022b: Serial date numbers not recommended

Although `optstocksensbyblk`

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)