Calculate price or sensitivities for European barrier options using BlackScholes option pricing model
PriceSens = barriersensbybls(RateSpec,StockSpec,OptSpec,Strike,Settle,ExerciseDates,BarrierSpec,Barrier)
PriceSens = barriersensbybls(___,Name,Value)
calculates
European barrier option prices or sensitivities using the BlackScholes
option pricing model.PriceSens
= barriersensbybls(RateSpec
,StockSpec
,OptSpec
,Strike
,Settle
,ExerciseDates
,BarrierSpec
,Barrier
)
adds optional namevalue pair arguments. PriceSens
= barriersensbybls(___,Name,Value
)
Compute price of European barrier down out and down in call options using the following data:
Rates = 0.035; Settle = '01Jan2015'; Maturity = '01April2015'; 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.9913
Rates: 0.0350
EndTimes: 0.2500
StartTimes: 0
EndDates: 736055
StartDates: 735965
ValuationDate: 735965
Basis: 1
EndMonthRule: 1
Define a StockSpec
.
AssetPrice = 19;
Volatility = 0.40;
DivType = 'Continuous';
DivAmount = 0.035;
StockSpec = stockspec(Volatility, AssetPrice, DivType, DivAmount)
StockSpec = struct with fields:
FinObj: 'StockSpec'
Sigma: 0.4000
AssetPrice: 19
DividendType: {'continuous'}
DividendAmounts: 0.0350
ExDividendDates: []
Calculate the price
, delta
, and gamma
for European barrier down out and down in call options using the BlackScholes option pricing model.
OptSpec = 'Call'; Strike = 20; Barrier = 18; BarrierSpec = {'DO';'DI'}; OutSpec = {'price', 'delta', 'gamma'}; [Price, Delta, Gamma] = barriersensbybls(RateSpec, StockSpec, OptSpec, Strike, Settle,... Maturity, BarrierSpec, Barrier,'OutSpec', OutSpec)
Price = 2×1
0.6287
0.4655
Delta = 2×1
0.6376
0.2036
Gamma = 2×1
0.0255
0.0773
StockSpec
— Stock specification for underlying assetStock 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 'call'
or
'put'
 string array with values "call"
or
"put"
Definition of the option as 'call'
or 'put'
, specified
as an NINST
by1
cell array of
character vectors or string arrays with values "call"
or
"put"
.
Data Types: char
 string
 cell
Strike
— Option strike price valueOption strike price value, specified as an NINST
by1
matrix of numeric values.
Data Types: double
Settle
— Settlement or trade dateSettlement or trade date for the barrier option, specified as an
NINST
by1
matrix using serial
date numbers, date character vectors, or datetime objects.
Data Types: double
 char
 datetime
ExerciseDates
— Option exercise datesOption exercise dates, specified as an
NINST
by1
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 type'UI'
, 'UO'
, 'DI'
, 'DO'
Barrier option type, specified as an NINST
by1
cell
array of character vectors with the following values:
'UI'
— Up Knockin
This 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 Knockout
This 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 upandout option, the rebate is paid if the spot price of the underlying reaches or exceeds the barrier level.
'DI'
— Down Knockin
This 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 downandin 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 Knockup
This 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 Knockout  Worthless  Standard Call/Put 
Call/Put  Down Knockin  Call/Put  Worthless 
Call/Put  Up Knockout  Worthless  Standard Call/Put 
Call/Put  Up Knockin  Standard Call/Put  Worthless 
Data Types: char
 cell
Barrier
— Barrier levelBarrier level, specified as an
NINST
by1
matrix of numeric
values.
Data Types: double
Specify optional
commaseparated 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 = barriersensbybls(RateSpec,StockSpec,OptSpec,Strike,Settle,Maturity,BarrierSpec,Barrier,'Rebate',1000,'OutSpec','Delta')
'Rebate'
— Rebate values0
(default)  numeric Rebate values, specified as the commaseparated pair consisting of
'Rebate'
and
NINST
by1
matrix of numeric
values. For Knockin options, the Rebate
is paid at
expiry. For Knockout options, the Rebate
is paid
when the Barrier
is reached.
Data Types: double
'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 commaseparated pair consisting of
'OutSpec'
and a NOUT

by1
or a
1
byNOUT
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
PriceSens
— Expected prices or sensitivities for barrier optionsExpected prices at time 0 or sensitivities (defined using OutSpec
)
for barrier options, returned as a NINST
by1
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.
[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 knockin 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.
barrierbybls
 barrierbyfd
 barrierbyls
 barriersensbyfd
 barriersensbyls
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.