Price European barrier options using Black-Scholes option pricing model

calculates
European barrier option prices using the Black-Scholes option pricing
model.`Price`

= barrierbybls(`RateSpec`

,`StockSpec`

,`OptSpec`

,`Strike`

,`Settle`

,`ExerciseDates`

,`BarrierSpec`

,`Barrier`

)

adds optional name-value pair arguments. `Price`

= barrierbybls(___,`Name,Value`

)

Compute the price of an European barrier down out call option using the following data:

Rates = 0.035; Settle = '01-Jan-2015'; Maturity = '01-jan-2016'; Compounding = -1; Basis = 1;

Define a `RateSpec`

.

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

`RateSpec = `*struct with fields:*
FinObj: 'RateSpec'
Compounding: -1
Disc: 0.9656
Rates: 0.0350
EndTimes: 1
StartTimes: 0
EndDates: 736330
StartDates: 735965
ValuationDate: 735965
Basis: 1
EndMonthRule: 1

Define a `StockSpec`

.

AssetPrice = 50; Volatility = 0.30; StockSpec = stockspec(Volatility, AssetPrice)

`StockSpec = `*struct with fields:*
FinObj: 'StockSpec'
Sigma: 0.3000
AssetPrice: 50
DividendType: []
DividendAmounts: 0
ExDividendDates: []

Calculate the price of an European barrier down out call option using the Black-Scholes option pricing model.

Strike = 50; OptSpec = 'call'; Barrier = 45; BarrierSpec = 'DO'; Price = barrierbybls(RateSpec, StockSpec, OptSpec, Strike, Settle,... Maturity, BarrierSpec, Barrier)

Price = 4.4285

Compute the price of European down out and down in call options using the following data:

Rates = 0.035; Settle = '01-Jan-2015'; Maturity = '01-jan-2016'; Compounding = -1; Basis = 1;

Define a `RateSpec`

.

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

`RateSpec = `*struct with fields:*
FinObj: 'RateSpec'
Compounding: -1
Disc: 0.9656
Rates: 0.0350
EndTimes: 1
StartTimes: 0
EndDates: 736330
StartDates: 735965
ValuationDate: 735965
Basis: 1
EndMonthRule: 1

Define a `StockSpec`

.

AssetPrice = 50; Volatility = 0.30; StockSpec = stockspec(Volatility, AssetPrice)

`StockSpec = `*struct with fields:*
FinObj: 'StockSpec'
Sigma: 0.3000
AssetPrice: 50
DividendType: []
DividendAmounts: 0
ExDividendDates: []

Calculate the price of European barrier down out and down in call options using the Black-Scholes Option Pricing model.

Strike = 50; OptSpec = 'Call'; Barrier = 45; BarrierSpec = {'DO';'DI'}; Price = barrierbybls(RateSpec, StockSpec, OptSpec, Strike, Settle, Maturity, BarrierSpec, Barrier)

`Price = `*2×1*
4.4285
2.3301

`StockSpec`

— Stock specification for underlying assetstructure

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`

`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 an
`NINST`

-by-`1`

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

or
`'put'`

or
`"call"`

or
`"put"`

.

**Data Types: **`char`

| `cell`

| `string`

`Strike`

— Option strike price valuenumeric

Option strike price value, specified as an `NINST`

-by-`1`

matrix of numeric values, where each row is the
schedule for one option.

**Data Types: **`double`

`Settle`

— Settlement or trade dateserial date number | date character vector | datetime object

Settlement or trade date for the barrier option, specified as an
`NINST`

-by-`1`

matrix using serial date numbers, date character
vectors, or datetime objects.

**Data Types: **`double`

| `char`

| `datetime`

`ExerciseDates`

— Option exercise datesserial date number | date character vector | datetime object

Option exercise dates, specified as an `NINST`

-by-`1`

matrix
of serial date numbers, date character vectors, or
datetime objects.

For a European option, there is only one
`ExerciseDates`

on the option
expiry date which is the maturity of the
instrument.

**Data Types: **`double`

| `char`

| `datetime`

`BarrierSpec`

— Barrier option typecharacter vector with values:

`'UI'`

, `'UO'`

, `'DI'`

, `'DO'`

Barrier option type, specified as an `NINST`

-by-`1`

cell
array of character vectors with the following
values:

`'UI'`

— Up Knock-inThis option becomes effective when the price of the underlying asset passes above the barrier level. It gives the option holder the right, but not the obligation, to buy or sell (call/put) the underlying security at the strike price if the underlying asset goes above the barrier level during the life of the option.

`'UO'`

— Up Knock-outThis option gives the option holder the right, but not the obligation, to buy or sell (call/put) the underlying security at the strike price as long as the underlying asset does not go above the barrier level during the life of the option. This option terminates when the price of the underlying asset passes above the barrier level. Usually with an up-and-out option, the rebate is paid if the spot price of the underlying reaches or exceeds the barrier level.

`'DI'`

— Down Knock-nThis option becomes effective when the price of the underlying stock passes below the barrier level. It gives the option holder the right, but not the obligation, to buy or sell (call/put) the underlying security at the strike price if the underlying security goes below the barrier level during the life of the option. With a down-and-in option, the rebate is paid if the spot price of the underlying does not reach the barrier level during the life of the option.

`'DO'`

— Down Knock-upThis option gives the option holder the right, but not the obligation, to buy or sell (call/put) the underlying asset at the strike price as long as the underlying asset does not go below the barrier level during the life of the option. This option terminates when the price of the underlying security passes below the barrier level. Usually, the option holder receives a rebate amount if the option expires worthless.

Option | Barrier Type | Payoff if Barrier Crossed | Payoff if Barrier not Crossed |
---|---|---|---|

Call/Put | Down Knock-out | Worthless | Standard Call/Put |

Call/Put | Down Knock-in | Call/Put | Worthless |

Call/Put | Up Knock-out | Worthless | Standard Call/Put |

Call/Put | Up Knock-in | Standard Call/Put | Worthless |

**Data Types: **`char`

| `cell`

`Barrier`

— Barrier levelnumeric

Barrier level, specified as
`NINST`

-by-`1`

matrix of numeric values.

**Data Types: **`double`

Specify optional
comma-separated pairs of `Name,Value`

arguments. `Name`

is
the argument name and `Value`

is the corresponding value.
`Name`

must appear inside quotes. You can specify several name and value
pair arguments in any order as
`Name1,Value1,...,NameN,ValueN`

.

`Price = barrierbybls(RateSpec,StockSpec,OptSpec,Strike,Settle,Maturity,BarrierSpec,Barrier,Rebate,1000)`

`'Rebate'`

— Rebate value`0`

(default) | numericRebate value, specified as the comma-separated pair consisting of `'Rebate'`

and
`NINST`

-by-`1`

matrix of numeric values. For Knock-in options,
the `Rebate`

is paid at expiry.
For Knock-out options, the
`Rebate`

is paid when the
`Barrier`

is reached.

**Data Types: **`double`

`Price`

— Expected prices for barrier optionsmatrix

Expected prices for barrier options at time 0, returned as a `NINST`

-by-`1`

matrix.

A *Barrier option* has not only a strike price but also
a barrier level and sometimes a rebate.

A rebate is a fixed amount that is paid if the option cannot be exercised because the barrier
level has been reached or not reached. The payoff for this type of option depends on whether
the underlying asset crosses the predetermined trigger value (barrier level), indicated by
`Barrier`

, during the life of the option. For more information, see
Barrier Option.

[1] Hull, J. *Options, Futures and Other Derivatives* Fourth
Edition. Prentice Hall, 2000, pp. 646–649.

[2] Aitsahlia, F., L. Imhof, and T.L. Lai. “Pricing and hedging
of American knock-in options.” *The Journal of Derivatives.* Vol.
11.3, 2004, pp. 44–50.

[3] Rubinstein M. and E. Reiner. “Breaking down the barriers.” *Risk.* Vol.
4(8), 1991, pp. 28–35.

`barrierbyfd`

| `barrierbyls`

| `barriersensbybls`

| `barriersensbyfd`

| `barriersensbyls`

A modified version of this example exists on your system. Do you want to open this version instead?

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.

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

Select web siteYou can also select a web site from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

- América Latina (Español)
- Canada (English)
- United States (English)

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