DoubleBarrier
Description
Create and price a DoubleBarrier
instrument object for one
of more Double Barrier instruments using this workflow:
Use
fininstrument
to create aDoubleBarrier
instrument object for one of more Double Barrier instruments.Use
finmodel
to specify aBlackScholes
,Heston
,Bates
, orMerton
model for theDoubleBarrier
instrument object.Choose a pricing method.
When using a
BlackScholes
model, usefinpricer
to specify anIkedaKunitomo
orVannaVolga
pricing method for one or moreDoubleBarrier
instruments.When using a
BlackScholes
,Heston
,Bates
, orMerton
model, usefinpricer
to specify aFiniteDifference
or anAssetMonteCarlo
pricing method for one or moreDoubleBarrier
instruments.
For more information on this workflow, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.
For more information on the available models and pricing methods for a
DoubleBarrier
instrument, see Choose Instruments, Models, and Pricers.
Creation
Syntax
Description
creates a DoubleBarrierOpt
= fininstrument(InstrumentType
,'Strike
',strike_value,'ExerciseDate
',exercise_date,'BarrierValue
',barrier_value)DoubleBarrier
instrument object for one of more
Double Barrier instruments by specifying InstrumentType
and sets properties using
the required name-value pair arguments Strike
,
ExerciseDate
, and
BarrierValue
.
sets optional properties using
additional name-value pair arguments in addition to the required arguments
in the previous syntax. For example, DoubleBarrierOpt
= fininstrument(___,Name,Value
)DoubleBarrierOpt =
fininstrument("DoubleBarrier",'Strike',100,'ExerciseDate',datetime(2019,1,30),'BarrierValue',110,'OptionType',"put",'ExerciseStyle',"European",'BarrierType',"DKI",'Name',"doublebarrier_option")
creates a DoubleBarrier
put option with a European
exercise. You can specify multiple name-value pair arguments.
Input Arguments
InstrumentType
— Instrument type
string with value "DoubleBarrier"
| string array with values of
"DoubleBarrier"
| character vector with value
'DoubleBarrier'
| cell array of character vectors with values of
'DoubleBarrier'
Instrument type, specified as a string with the value of
"DoubleBarrier"
, a character vector with the
value of 'DoubleBarrier'
, an
NINST
-by-1
string array with
values of "DoubleBarrier"
, or an
NINST
-by-1
cell array of
character vectors with values of
'DoubleBarrier'
.
Data Types: char
| cell
| string
Specify required
and 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: DoubleBarrierOpt =
fininstrument("DoubleBarrier",'Strike',100,'ExerciseDate',datetime(2019,1,30),'BarrierValue',110,'OptionType',"put",'ExerciseStyle',"European",'BarrierType',"DKI",'Name',"doublebarrier_option")
DoubleBarrier
Name-Value Pair
ArgumentsStrike
— Option strike value
nonnegative value | vector of nonnegative values
Option strike price value, specified as the comma-separated pair
consisting of 'Strike'
and a scalar nonnegative
value or an NINST
-by-1
vector
of nonnegative values.
Data Types: double
ExerciseDate
— Option exercise date
datetime array | string array | date character vector
Option exercise date, specified as the comma-separated pair
consisting of 'ExerciseDate'
and a scalar or an
NINST
-by-1
vector using a
datetime array, string array, or date character vectors.
Note
For a European option, there is only one
ExerciseDate
value on the option
expiry date.
To support existing code, DoubleBarrier
also
accepts serial date numbers as inputs, but they are not recommended.
If you use date character vectors or strings, the format must be
recognizable by datetime
because
the ExerciseDate
property is stored as a
datetime.
BarrierValue
— Double barrier value
numeric
Double barrier value, specified as the comma-separated pair
consisting of 'BarrierValue'
and an
NINST
-by-1
matrix of
numeric values, where each element is a
1
-by-2
vector where the
first column is Barrier(1)(UB) and the second column is
Barrier(2)(LB). Barrier(1) must be greater than Barrier(2).
Data Types: double
DoubleBarrier
Name-Value Pair
ArgumentsOptionType
— Option type
"call"
(default) | string with value "call"
or
"put"
| string array with values "call"
or
"put"
| character vector with value 'call'
or
'put'
| cell array of character vectors with values
'call'
or 'put'
Option type, specified as the comma-separated pair consisting of
'OptionType'
and a scalar string or character
vector or an NINST
-by-1
cell
array of character vectors or string array.
Data Types: char
| cell
| string
ExerciseStyle
— Option exercise style
"European"
(default) | string with value "European"
or
"American"
| string array with values "European"
or
"American"
| character vector with value 'European'
or
'American'
| cell array of character vectors with values
'European'
or
'American'
Option exercise style, specified as the comma-separated pair
consisting of 'ExerciseStyle'
and a scalar string
or character vector or an
NINST
-by-1
cell array of
character vectors or string array.
Note
For a DoubleBarrier
option, the IkedaKunitomo
pricer supports only a
"European"
exercise and the FiniteDifference
pricer supports an
"American"
or
"European"
exercise.
Data Types: string
| cell
| char
BarrierType
— Double barrier type
"DKO"
(default) | string with value of "DKI"
or
"DKO"
| string array with values of "DKI"
or
"DKO"
| character vector with value of 'DKI'
or
'DKO'
| cell array of character vectors with values of
'DKI'
or 'DKO'
Double barrier type, specified as the comma-separated pair
consisting of 'BarrierType'
and a scalar
character vector or string or an
NINST
-by-1
cell array of
character vectors or string array with one of the following values:
'DKI'
— Double knock-inThe
'DKI'
option becomes effective when the price of the underlying asset reaches one of the barriers. It gives the option holder the right but not the obligation to buy or sell the underlying security at the strike price, if the underlying asset goes above or below the barrier levels during the life of the option.'DKO'
— Double knock-outThe
'DKO'
option gives the option holder the right but not the obligation to buy or sell the underlying security at the strike price, as long as the underlying asset remains between the barrier levels during the life of the option. This option terminates when the price of the underlying asset passes one of the barriers.
Option | Barrier Type | Payoff If Any Barrier Crossed | Payoff If Barriers Not Crossed |
---|---|---|---|
Call/Put | Double Knock-in | Standard Call/Put | Worthless |
Call/Put | Double Knock-out | Worthless | Standard Call/Put |
Data Types: char
| cell
| string
Rebate
— Barrier rebate
[0 0]
(default) | numeric
Barrier rebate, specified as the comma-separated pair consisting
of 'Rebate'
and a numeric matrix.
For knock-in options, the
Rebate
is paid at expiry.For knock-out options, the
Rebate
is paid if the Upper Barrier(1)(UB) is hit and the second value is paid if the Lower Barrier(2)(LB) is hit.
Data Types: double
Name
— User-defined name for instrument
" "
(default) | string | string array | character vector | cell array of character vectors
User-defined name for the instrument, specified as the
comma-separated pair consisting of 'Name'
and a
scalar string or character vector or an
NINST
-by-1
cell array of
character vectors or string array.
Data Types: char
| cell
| string
Properties
Strike
— Option strike price value
nonnegative value | vector of nonnegative values
Option strike price value, returned as a scalar nonnegative value or an
NINST
-by-1
vector of nonnegative
values.
Data Types: double
ExerciseDate
— Option exercise date
datetime | vector of datetimes
Option exercise date, returned as a datetime or an
NINST
-by-1
vector of
datetimes.
Data Types: datetime
BarrierValue
— Double barrier value
numeric
Double barrier value, returned as a numeric matrix.
Data Types: double
OptionType
— Option type
"call"
(default) | string with value "call"
or
"put"
| string array with values "call"
or
"put"
Option type, returned as a scalar string or an
NINST
-by-1
string array with the
values "call"
or "put"
.
Data Types: string
ExerciseStyle
— Option exercise style
"European"
(default) | string with value "European"
or
"American"
| string array with values "European"
or
"American"
Option exercise style, returned as a scalar string or an
NINST
-by-1
string array with the
values of "European"
or "American"
.
Data Types: string
BarrierType
— Double barrier type
"DKO"
(default) | string with value of "DKI"
or
"DKO"
| string array with values of "DKI"
or
"DKO"
Double barrier type, returned as a scalar string or an
NINST
-by-1
string array with the
values of "DKI"
or "DKO"
.
Data Types: string
Rebate
— Barrier rebate
[0 0]
(default) | numeric
Barrier rebate, returned as a numeric matrix.
Data Types: double
Name
— User-defined name for instrument
" "
(default) | string | string array
User-defined name for the instrument, returned as a scalar string or an
NINST
-by-1
string array.
Data Types: string
Examples
Price DoubleBarrier
Instrument Using BlackScholes
Model and FiniteDifference
Pricer
This example shows the workflow to price an DoubleBarrier
instrument when you use a BlackScholes
model and a FiniteDifference
pricing method.
Create DoubleBarrier
Instrument Object
Use fininstrument
to create a DoubleBarrier
instrument object.
DoubleBarrierOpt = fininstrument("DoubleBarrier",'Strike',75,'ExerciseDate',datetime(2019,1,1),'OptionType',"call",'ExerciseStyle',"american",'BarrierType',"DKO",'BarrierValue',[110 80],'Name',"doublebarrier_option")
DoubleBarrierOpt = DoubleBarrier with properties: OptionType: "call" Strike: 75 BarrierValue: [110 80] ExerciseStyle: "american" ExerciseDate: 01-Jan-2019 BarrierType: "dko" Rebate: [0 0] Name: "doublebarrier_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',0.30)
BlackScholesModel = BlackScholes with properties: Volatility: 0.3000 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2018,1,1); Maturity = datetime(2023,1,1); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',1)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 1 Dates: 01-Jan-2023 Rates: 0.0350 Settle: 01-Jan-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create FiniteDifference
Pricer Object
Use finpricer
to create a FiniteDifference
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("FiniteDifference",'Model',BlackScholesModel,'DiscountCurve',myRC,'SpotPrice',100)
outPricer = FiniteDifference with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 100 GridProperties: [1x1 struct] DividendType: "continuous" DividendValue: 0
Price DoubleBarrier
Instrument
Use price
to compute the price and sensitivities for the DoubleBarrier
instrument.
[Price, outPR] = price(outPricer,DoubleBarrierOpt,["all"])
Price = 25
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Theta Rho Vega
_____ _____ _____ ______ __________ ___ ____
25 1 0 4 2.2737e-13 0 0
Price Multiple DoubleBarrier
Instruments Using BlackScholes
Model and FiniteDifference
Pricer
This example shows the workflow to price multiple DoubleBarrier
instruments when you use a BlackScholes
model and a FiniteDifference
pricing method.
Create DoubleBarrier
Instrument Object
Use fininstrument
to create a DoubleBarrier
instrument object for three Double Barrier instruments.
DoubleBarrierOpt = fininstrument("DoubleBarrier",'Strike',[75 ; 85 ; 95],'ExerciseDate',datetime([2019,1,1 ; 2019,1,2 ; 2019,1,3]),'OptionType',"call",'ExerciseStyle',"american",'BarrierType',"DKO",'BarrierValue',[110 80],'Name',"doublebarrier_option")
DoubleBarrierOpt=3×1 DoubleBarrier array with properties:
OptionType
Strike
BarrierValue
ExerciseStyle
ExerciseDate
BarrierType
Rebate
Name
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',0.30)
BlackScholesModel = BlackScholes with properties: Volatility: 0.3000 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2018,1,1); Maturity = datetime(2023,1,1); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',1)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 1 Dates: 01-Jan-2023 Rates: 0.0350 Settle: 01-Jan-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create FiniteDifference
Pricer Object
Use finpricer
to create a FiniteDifference
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("FiniteDifference",'Model',BlackScholesModel,'DiscountCurve',myRC,'SpotPrice',100)
outPricer = FiniteDifference with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 100 GridProperties: [1x1 struct] DividendType: "continuous" DividendValue: 0
Price DoubleBarrier
Instruments
Use price
to compute the prices and sensitivities for the DoubleBarrier
instruments.
[Price, outPR] = price(outPricer,DoubleBarrierOpt,["all"])
Price = 3×1
25.0000
15.6821
7.8957
outPR=3×1 priceresult array with properties:
Results
PricerData
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Theta Rho Vega
_____ _____ _____ ______ __________ ___ ____
25 1 0 4 2.2737e-13 0 0
ans=1×7 table
Price Delta Gamma Lambda Theta Rho Vega
______ ______ _______ ______ _______ _____ _______
15.682 0.7196 0.28626 4.5887 0.88484 6.467 -6.3778
ans=1×7 table
Price Delta Gamma Lambda Theta Rho Vega
______ _______ __________ ______ _________ ______ _______
7.8957 0.36913 -0.0020435 4.675 -0.057311 4.3022 -6.9367
Price DoubleBarrier
Instrument Using Heston
Model and AssetMonteCarlo
Pricer
This example shows the workflow to price a DoubleBarrier
instrument when you use a Heston
model and an AssetMonteCarlo
pricing method.
Create DoubleBarrier
Instrument Object
Use fininstrument
to create a DoubleBarrier
instrument object.
DoubleBarrierOpt = fininstrument("DoubleBarrier",'Strike',75,'ExerciseDate',datetime(2020,9,15),'OptionType',"call",'ExerciseStyle',"american",'BarrierType',"DKO",'BarrierValue',[110 80],'Name',"doublebarrier_option")
DoubleBarrierOpt = DoubleBarrier with properties: OptionType: "call" Strike: 75 BarrierValue: [110 80] ExerciseStyle: "american" ExerciseDate: 15-Sep-2020 BarrierType: "dko" Rebate: [0 0] Name: "doublebarrier_option"
Create Heston
Model Object
Use finmodel
to create a Heston
model object.
HestonModel = finmodel("Heston",'V0',0.032,'ThetaV',0.1,'Kappa',0.003,'SigmaV',0.2,'RhoSV',0.9)
HestonModel = Heston with properties: V0: 0.0320 ThetaV: 0.1000 Kappa: 0.0030 SigmaV: 0.2000 RhoSV: 0.9000
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2018,9,15); Maturity = datetime(2023,9,15); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 12 Dates: 15-Sep-2023 Rates: 0.0350 Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create AssetMonteCarlo
Pricer Object
Use finpricer
to create an AssetMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("AssetMonteCarlo",'DiscountCurve',myRC,"Model",HestonModel,'SpotPrice',102,'simulationDates',datetime(2020,9,15))
outPricer = HestonMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 102 SimulationDates: 15-Sep-2020 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.Heston] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "standard" BrownianMotionMethod: "standard"
Price DoubleBarrier
Instrument
Use price
to compute the price and sensitivities for the DoubleBarrier
instrument.
[Price, outPR] = price(outPricer,DoubleBarrierOpt,["all"])
Price = 32.6351
outPR = priceresult with properties: Results: [1x8 table] PricerData: [1x1 struct]
outPR.Results
ans=1×8 table
Price Delta Gamma Lambda Rho Theta Vega VegaLT
______ ___________ __________ __________ _______ ______ _______ _________
32.635 -0.00089196 -0.0025511 -0.0027878 -76.828 1.1334 -0.2616 -0.002986
Price DoubleBarrier
Instrument Using Hesto
n Model and AssetMonteCarlo
Pricer with Quasi-Monte Carlo Simulation
This example shows the workflow to price a DoubleBarrier
instrument when you use a Heston
model and an AssetMonteCarlo
pricing method with quasi-Monte Carlo simulation..
Create DoubleBarrier
Instrument Object
Use fininstrument
to create a DoubleBarrier
instrument object.
DoubleBarrierOpt = fininstrument("DoubleBarrier",'Strike',75,'ExerciseDate',datetime(2020,9,15),'OptionType',"call",'ExerciseStyle',"american",'BarrierType',"DKO",'BarrierValue',[110 80],'Name',"doublebarrier_option")
DoubleBarrierOpt = DoubleBarrier with properties: OptionType: "call" Strike: 75 BarrierValue: [110 80] ExerciseStyle: "american" ExerciseDate: 15-Sep-2020 BarrierType: "dko" Rebate: [0 0] Name: "doublebarrier_option"
Create Heston
Model Object
Use finmodel
to create a Heston
model object.
HestonModel = finmodel("Heston",'V0',0.032,'ThetaV',0.1,'Kappa',0.003,'SigmaV',0.2,'RhoSV',0.9)
HestonModel = Heston with properties: V0: 0.0320 ThetaV: 0.1000 Kappa: 0.0030 SigmaV: 0.2000 RhoSV: 0.9000
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2018,9,15); Maturity = datetime(2023,9,15); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 12 Dates: 15-Sep-2023 Rates: 0.0350 Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create AssetMonteCarlo
Pricer Object
Use finpricer
to create an AssetMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value argument and use the name-value arguments for MonteCarloMethod
and BrownianMotionMethod
.
outPricer = finpricer("AssetMonteCarlo",'DiscountCurve',myRC,"Model",HestonModel,'SpotPrice',102,'simulationDates',datetime(2020,9,15),'NumTrials',1e3, ... 'MonteCarloMethod',"quasi",'BrownianMotionMethod',"brownian-bridge")
outPricer = HestonMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 102 SimulationDates: 15-Sep-2020 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.Heston] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "quasi" BrownianMotionMethod: "brownian-bridge"
Price DoubleBarrier
Instrument
Use price
to compute the price and sensitivities for the DoubleBarrier
instrument.
[Price, outPR] = price(outPricer,DoubleBarrierOpt,"all")
Price = 32.6329
outPR = priceresult with properties: Results: [1x8 table] PricerData: [1x1 struct]
outPR.Results
ans=1×8 table
Price Delta Gamma Lambda Rho Theta Vega VegaLT
______ _____ _____ ______ _______ ______ ____ ______
32.633 0 0 0 -65.286 1.1398 0 0
Price DoubleBarrier
Instrument Using BlackScholes
Model and AssetMonteCarlo
Pricer
This example shows the workflow to price a DoubleBarrier
instrument when you use a BlackScholes
model and an AssetMonteCarlo
pricing method.
Create DoubleBarrier
Instrument Object
Use fininstrument
to create a DoubleBarrier
instrument object.
DoubleBarrierOpt = fininstrument("DoubleBarrier",'Strike',100,'ExerciseDate',datetime(2020,8,15),'OptionType',"call",'ExerciseStyle',"american",'BarrierType',"DKO",'BarrierValue',[110 80],'Name',"doublebarrier_option")
DoubleBarrierOpt = DoubleBarrier with properties: OptionType: "call" Strike: 100 BarrierValue: [110 80] ExerciseStyle: "american" ExerciseDate: 15-Aug-2020 BarrierType: "dko" Rebate: [0 0] Name: "doublebarrier_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes","Volatility",.3)
BlackScholesModel = BlackScholes with properties: Volatility: 0.3000 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2017,9,15); Maturity = datetime(2023,9,15); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 12 Dates: 15-Sep-2023 Rates: 0.0350 Settle: 15-Sep-2017 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create AssetMonteCarlo
Pricer Object
Use finpricer
to create an AssetMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
ExerciseDate = datetime(2020,08,15); Settle = datetime(2017,09,15); outPricer = finpricer("AssetMonteCarlo","DiscountCurve",myRC,"Model",BlackScholesModel,'SpotPrice',100,'simulationDates', Settle+days(1):days(1):ExerciseDate);
Price DoubleBarrier
Instrument
Use price
to compute the price and sensitivities for the DoubleBarrier
instrument.
[Price, outPR] = price(outPricer,DoubleBarrierOpt,["all"])
Price = 6.9667
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
______ _______ _________ ______ _______ ______ _______
6.9667 0.26875 -0.096337 3.8576 0.39855 9.5406 -1.2907
Price DoubleBarrier
Instrument Using BlackScholes
Model and IkedaKunitomo
Pricer
This example shows the workflow to price a DoubleBarrier
instrument when you use a BlackScholes
model and an IkedaKunitomo
pricing method.
Create DoubleBarrier
Instrument Object
Use fininstrument
to create a DoubleBarrier
instrument object.
DoubleBarrierOpt = fininstrument("DoubleBarrier",'Strike',100,'ExerciseDate',datetime(2020,8,15),'OptionType',"call",'ExerciseStyle',"European",'BarrierType',"DKO",'BarrierValue',[110 80],'Name',"doublebarrier_option")
DoubleBarrierOpt = DoubleBarrier with properties: OptionType: "call" Strike: 100 BarrierValue: [110 80] ExerciseStyle: "european" ExerciseDate: 15-Aug-2020 BarrierType: "dko" Rebate: [0 0] Name: "doublebarrier_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes","Volatility",.3)
BlackScholesModel = BlackScholes with properties: Volatility: 0.3000 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2017,9,15); Maturity = datetime(2023,9,15); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 12 Dates: 15-Sep-2023 Rates: 0.0350 Settle: 15-Sep-2017 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create IkedaKunitomo
Pricer Object
Use finpricer
to create an IkedaKunitomo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("Analytic","DiscountCurve",myRC,"Model",BlackScholesModel,'SpotPrice',100,'Curvature',[0.03 -0.03],'DividendValue',0.029,"PricingMethod","IkedaKunitomo")
outPricer = IkedaKunitomo with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 100 DividendValue: 0.0290 DividendType: "continuous" Curvature: [0.0300 -0.0300]
Price DoubleBarrier
Instrument
Use price
to compute the price and sensitivities for the DoubleBarrier
instrument.
[Price, outPR] = price(outPricer,DoubleBarrierOpt,["all"])
Price = 5.6848e-04
outPR = priceresult with properties: Results: [1x7 table] PricerData: []
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Vega Theta Rho
__________ ___________ ___________ _______ _________ _________ ___________
0.00056848 -3.7713e-05 -4.2071e-06 -6.6339 -0.031332 0.0008912 -0.00035113
Price DoubleBarrier
Instrument Using BlackScholes
Model and VannaVolga
Pricer
This example shows the workflow to price a DoubleBarrier
instrument when you use a BlackScholes
model and a VannaVolga
pricing method.
Create DoubleBarrier
Instrument Object
Use fininstrument
to create a DoubleBarrier
instrument object.
DoubleBarrierOpt = fininstrument("DoubleBarrier",'Strike',100,'ExerciseDate',datetime(2020,8,15),'OptionType',"call",'ExerciseStyle',"European",'BarrierType',"DKO",'BarrierValue',[110 80],'Name',"doublebarrier_option")
DoubleBarrierOpt = DoubleBarrier with properties: OptionType: "call" Strike: 100 BarrierValue: [110 80] ExerciseStyle: "european" ExerciseDate: 15-Aug-2020 BarrierType: "dko" Rebate: [0 0] Name: "doublebarrier_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes","Volatility",0.02)
BlackScholesModel = BlackScholes with properties: Volatility: 0.0200 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2019,9,15); Maturity = datetime(2023,9,15); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 12 Dates: 15-Sep-2023 Rates: 0.0350 Settle: 15-Sep-2019 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create VannaVolga
Pricer Object
Use finpricer
to create a VannaVolga
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
VolRR = -0.0045; VolBF = 0.0037; RateF = 0.0210; outPricer = finpricer("VannaVolga","DiscountCurve",myRC,"Model",BlackScholesModel,'SpotPrice',100,'DividendValue',RateF,'VolatilityRR',VolRR,'VolatilityBF',VolBF)
outPricer = VannaVolga with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 100 DividendType: "continuous" DividendValue: 0.0210 VolatilityRR: -0.0045 VolatilityBF: 0.0037
Price DoubleBarrier
Instrument
Use price
to compute the price and sensitivities for the DoubleBarrier
instrument.
[Price, outPR] = price(outPricer,DoubleBarrierOpt,["all"])
Price = 1.6450
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Vega Theta Rho
_____ _______ ______ ______ ______ _______ ______
1.645 0.82818 75.662 50.346 14.697 -1.3145 74.666
More About
Double Barrier Option
A double barrier option is similar to the standard single barrier option except that they have two barrier levels: a lower barrier (LB) and an upper barrier (UB).
The payoff for a double barrier option depends on whether the underlying asset remains between the barrier levels during the life of the option. Double barrier options are less expensive than single barrier options as the probability of being knocked out is higher. Because of this, double barrier options allow investors to achieve reduction in the option premiums and match an investor’s belief about the future movement of the underlying price process.
There are two types of double barrier options:
Double knock-in
This option becomes effective when the price of the underlying asset reaches one of the barriers. It gives the option holder the right but not the obligation to buy or sell the underlying security at the strike price, if the underlying asset goes above or below the barrier levels during the life of the option.
Double knock-out
This option gives the option holder the right but not the obligation to buy or sell the underlying security at the strike price, as long as the underlying asset remains between the barrier levels during the life of the option. This option terminates when the price of the underlying asset passes one of the barriers.
The payoff for this type of option depends on whether the underlying asset crosses
the predetermined trigger value (barrier level), indicated by
BarrierValue
, during the life of the option. If the option
cannot be exercised because the barrier level either has or has not been reached, a
fixed rebate amount is paid. For more information, see Double Barrier Option.
Tips
After creating an DoubleBarrier
instrument object with an
ExerciseStyle
set to "American"
, you can
modify the ExerciseStyle
property to change it to
"European"
using dot
notation.
DoubleBarrier.ExerciseStyle = "European"
Strike
and
ExerciseDate
value and an American option has a 2-element
vector for Strike
and ExerciseDate
values,
when you change to ExerciseStyle
from "American"
to "European"
, the Strike
and
ExerciseDate
values become the last element in the 2-element
vector for the Strike
and ExerciseDate
values.Version History
Introduced in R2020bR2022b: Serial date numbers not recommended
Although DoubleBarrier
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 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
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)