Binary
Description
Create and price a Binary
instrument object for one or more
Binary instruments using this workflow:
Use
fininstrument
to create aBinary
instrument object for one or more Binary instruments.Use
finmodel
to specify aBlackScholes
,RoughBergomi
,RoughHeston
, orBachelier
model for theBinary
instrument object.Choose a pricing method.
When using a
BlackScholes
model, usefinpricer
to specify aBlackScholes
orAssetMonteCarlo
pricing method for one or moreBinary
instruments.When using a
RoughBergomi
orRoughHeston
model, usefinpricer
to specify aRoughVolMonteCarlo
pricing method for one or moreBinary
instruments.When using a
Bachelier
model, usefinpricer
to specify anAssetMonteCarlo
pricing method for one or moreBinary
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
Binary
instrument, see Choose Instruments, Models, and Pricers.
Creation
Syntax
Description
creates a BinaryOpt
= fininstrument(InstrumentType
,'Strike
',strike_value,'ExerciseDate
',exercise_date,'PayoffValue
',payoff_value)Binary
instrument object for one or more Binary
instruments by specifying InstrumentType
and sets properties using the
required name-value pair arguments Strike
,
ExerciseDate
, and
PayoffValue
.
sets optional properties using
additional name-value pair arguments in addition to the required arguments
in the previous syntax. For example, BinaryOpt
= fininstrument(___,Name,Value
)BinaryOpt =
fininstrument("Binary",'Strike',100,'ExerciseDate',datetime(2019,1,30),'PayoffValue',110,'OptionType',"put",'Name',"binary_option")
creates a Binary
put option with a
PayoffValue
of 110. You can specify multiple
name-value pair arguments.
Input Arguments
InstrumentType
— Instrument type
string with value "Binary"
| string array with values of "Binary"
| character vector with value 'Binary'
| cell array of character vectors with values of
'Binary'
Instrument type, specified as a string with the value of
"Binary"
, a character vector with the value of
'Binary'
, an
NINST
-by-1
string array with
values of "Binary"
, or an
NINST
-by-1
cell array of
character vectors with values of 'Binary'
.
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: BinaryOpt =
fininstrument("Binary",'Strike',100,'ExerciseDate',datetime(2019,1,30),'PayoffValue',110,'OptionType',"put",'Name',"binary_option")
Binary
Name-Value Pair ArgumentsStrike
— Option strike price 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.
To support existing code, Binary
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.
PayoffValue
— Option payoff value
scalar numeric | numeric vector
Option payoff value, specified as the comma-separated pair
consisting of 'PayoffValue'
and a scalar numeric
value or an NINST
-by-1
numeric
vector.
Data Types: double
Binary
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.
A call option pays out if the condition is met and the price of the underlying asset is above the specified level at expiration. A put option pays out if the condition is met and the price of the underlying asset is below the specified level at expiration.
Data Types: char
| cell
| string
ExerciseStyle
— Option exercise style
"European"
(default) | string with value "European"
| string array with a value "European"
| character vector with value 'European'
| cell array of character vectors with a value 'European'
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.
Data Types: string
| char
| cell
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 | 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
PayoffValue
— Option payoff value
scalar numeric | numeric vector
Option payoff value, returned as a scalar numeric value or an
NINST
-by-1
vector of numeric
values.
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 of "call"
or "put"
.
Data Types: string
ExerciseStyle
— Option exercise style
"European"
(default) | string with value "European"
| string array with values "European"
This property is read-only.
Option exercise style, returned as a scalar string or an
NINST
-by-1
string array with the
value of "European"
.
Data Types: string
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 Binary
Instrument Using BlackScholes
Model and AssetMonteCarlo
Pricer
This example shows the workflow to price a Binary
instrument when you use a BlackScholes
model and an AssetMonteCarlo
pricing method.
Create Binary
Instrument Object
Use fininstrument
to create a Binary
instrument object.
BinaryOpt = fininstrument("Binary",'ExerciseDate',datetime(2022,9,15),'Strike',1000,'PayoffValue',130,'OptionType',"put",'Name',"binary_option")
BinaryOpt = Binary with properties: OptionType: "put" ExerciseDate: 15-Sep-2022 Strike: 1000 PayoffValue: 130 ExerciseStyle: "european" Name: "binary_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',.2)
BlackScholesModel = BlackScholes with properties: Volatility: 0.2000 Correlation: 1
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",BlackScholesModel,'SpotPrice',102,'simulationDates',datetime(2022,9,15))
outPricer = GBMMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 102 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.BlackScholes] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "standard" BrownianMotionMethod: "standard"
Price Binary
Instrument
Use price
to compute the price and sensitivities for the Binary
instrument.
[Price, outPR] = price(outPricer,BinaryOpt,["all"])
Price = 113.0166
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
______ _____ _____ ______ _______ ______ ____
113.02 0 0 0 -451.98 3.9582 0
Price Binary
Instrument Using RoughBergomi
Model and RoughVolMonteCarlo
Pricer
Since R2024a
This example shows the workflow to price a Binary
instrument when you use a RoughBergomi
model and a RoughVolMonteCarlo
pricing method.
Create Binary
Instrument Object
Use fininstrument
to create a Binary
instrument object.
BinaryOpt = fininstrument("Binary",ExerciseDate=datetime(2022,9,15),Strike=1000,PayoffValue=130,OptionType="put",Name="binary_option")
BinaryOpt = Binary with properties: OptionType: "put" ExerciseDate: 15-Sep-2022 Strike: 1000 PayoffValue: 130 ExerciseStyle: "european" Name: "binary_option"
Create RoughBergomi
Model Object
Use finmodel
to create a RoughBergomi
model object.
RoughBergomiModel = finmodel("RoughBergomi",Alpha=-0.32, Xi=0.1,Eta=0.003,RhoSV=0.9)
RoughBergomiModel = RoughBergomi with properties: Alpha: -0.3200 Xi: 0.1000 Eta: 0.0030 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 RoughVolMonteCarlo
Pricer Object
Use finpricer
to create a RoughVolMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value argument.
outPricer = finpricer("RoughVolMonteCarlo",DiscountCurve=myRC,Model=RoughBergomiModel,SpotPrice=102,simulationDates=datetime(2022,9,15))
outPricer = RoughBergomiMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 102 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.RoughBergomi] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "standard" BrownianMotionMethod: "standard"
Price Binary
Instrument
Use price
to compute the price and sensitivities for the Binary
instrument.
[Price, outPR] = price(outPricer,BinaryOpt,"all")
Price = 112.9036
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
_____ _____ _____ ______ _______ ______ ____
112.9 0 0 0 -451.52 3.9542 0
Price Binary
Instrument Using RoughHeston
Model and RoughVolMonteCarlo
Pricer
Since R2024b
This example shows the workflow to price a Binary
instrument when you use a RoughHeston
model and a RoughVolMonteCarlo
pricing method.
Create Binary
Instrument Object
Use fininstrument
to create a Binary
instrument object.
BinaryOpt = fininstrument("Binary",ExerciseDate=datetime(2022,9,15),Strike=1000,PayoffValue=130,OptionType="put",Name="binary_option")
BinaryOpt = Binary with properties: OptionType: "put" ExerciseDate: 15-Sep-2022 Strike: 1000 PayoffValue: 130 ExerciseStyle: "european" Name: "binary_option"
Create RoughHeston
Model Object
Use finmodel
to create a RoughHeston
model object.
RoughBergomiModel = finmodel("RoughHeston",V0=0.4,ThetaV=0.3,Kappa=0.2,SigmaV=0.1,Alpha=-0.02,RhoSV=0.3)
RoughBergomiModel = RoughHeston with properties: Alpha: -0.0200 V0: 0.4000 ThetaV: 0.3000 Kappa: 0.2000 SigmaV: 0.1000 RhoSV: 0.3000
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 RoughVolMonteCarlo
Pricer Object
Use finpricer
to create a RoughVolMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value argument.
outPricer = finpricer("RoughVolMonteCarlo",DiscountCurve=myRC,Model=RoughBergomiModel,SpotPrice=102,simulationDates=datetime(2022,9,15))
outPricer = RoughHestonMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 102 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.RoughHeston] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "standard" BrownianMotionMethod: "standard"
Price Binary
Instrument
Use price
to compute the price and sensitivities for the Binary
instrument.
[Price, outPR] = price(outPricer,BinaryOpt,"all")
Price = 111.8864
outPR = priceresult with properties: Results: [1x8 table] PricerData: [1x1 struct]
outPR.Results
ans=1×8 table
Price Delta Gamma Lambda Rho Theta Vega VegaLT
______ _____ _____ ______ _______ ______ ____ ______
111.89 0 0 0 -447.46 3.9186 0 0
Price Binary
Instrument Using BlackScholes
Model and AssetMonteCarlo
Pricer with Quasi-Monte Carlo Simulation
This example shows the workflow to price a Binary
instrument when you use a BlackScholes
model and an AssetMonteCarlo
pricing method with quasi-Monte Carlo simulation.
Create Binary
Instrument Object
Use fininstrument
to create a Binary
instrument object.
BinaryOpt = fininstrument("Binary",'ExerciseDate',datetime(2022,9,15),'Strike',1000,'PayoffValue',130,'OptionType',"put",'Name',"binary_option")
BinaryOpt = Binary with properties: OptionType: "put" ExerciseDate: 15-Sep-2022 Strike: 1000 PayoffValue: 130 ExerciseStyle: "european" Name: "binary_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',.2)
BlackScholesModel = BlackScholes with properties: Volatility: 0.2000 Correlation: 1
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",BlackScholesModel,'SpotPrice',102,'simulationDates',datetime(2022,9,15),'NumTrials',1e3, ... 'MonteCarloMethod',"quasi",'BrownianMotionMethod',"brownian-bridge")
outPricer = GBMMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 102 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.BlackScholes] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "quasi" BrownianMotionMethod: "brownian-bridge"
Price Binary
Instrument
Use price
to compute the price and sensitivities for the Binary
instrument.
[Price, outPR] = price(outPricer,BinaryOpt,"all")
Price = 113.0166
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
______ _____ _____ ______ _______ ______ ____
113.02 0 0 0 -451.98 3.9582 0
Price Multiple Binary
Instruments Using BlackScholes
Model and BlackScholes
Pricer
This example shows the workflow to price multiple Binary
instruments when you use a BlackScholes
model and a BlackScholes
pricing method.
Create Binary
Instrument Object
Use fininstrument
to create a Binary
instrument object with three Binary instruments.
BinaryOpt = fininstrument("Binary",'ExerciseDate',datetime([2022,9,15 ; 2022,10,15 ; 2022,11,15]),'Strike',[1000 ; 2000 ; 3000],'PayoffValue',130,'OptionType',"put",'Name',"binary_option")
BinaryOpt=3×1 Binary array with properties:
OptionType
ExerciseDate
Strike
PayoffValue
ExerciseStyle
Name
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',0.28)
BlackScholesModel = BlackScholes with properties: Volatility: 0.2800 Correlation: 1
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 BlackScholes
Pricer Object
Use finpricer
to create a BlackScholes
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("analytic",'DiscountCurve',myRC,'Model',BlackScholesModel,'SpotPrice',800,'DividendValue',0.045)
outPricer = BlackScholes with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 800 DividendValue: 0.0450 DividendType: "continuous"
Price Binary
Instruments
Use price
to compute the prices and sensitivities for the Binary
instruments.
[Price, outPR] = price(outPricer,BinaryOpt,["all"])
Price = 3×1
87.4005
109.9703
111.9328
outPR=3×1 priceresult array with properties:
Results
PricerData
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Vega Theta Rho
_____ _________ ___________ _______ _______ ______ _______
87.4 -0.075973 -3.1264e-05 -0.6954 -23.084 3.2599 -592.61
ans=1×7 table
Price Delta Gamma Lambda Vega Theta Rho
______ _________ ___________ ________ _______ ______ _______
109.97 -0.014137 -4.4054e-05 -0.10284 -32.196 4.8405 -495.01
ans=1×7 table
Price Delta Gamma Lambda Vega Theta Rho
______ __________ __________ _________ _______ ______ _______
111.93 -0.0027668 -1.279e-05 -0.019775 -9.4868 4.2144 -475.57
Price Binary
Instrument Using Merton
Model and AssetMonteCarlo
Pricer
This example shows the workflow to price a Binary
instrument when you use a Merton
model and an AssetMonteCarlo
pricing method.
Create Binary
Instrument Object
Use fininstrument
to create a Binary
instrument object.
BinaryOpt = fininstrument("Binary",'ExerciseDate',datetime(2022,9,15),'Strike',1000,'PayoffValue',130,'OptionType',"put",'Name',"binary_option")
BinaryOpt = Binary with properties: OptionType: "put" ExerciseDate: 15-Sep-2022 Strike: 1000 PayoffValue: 130 ExerciseStyle: "european" Name: "binary_option"
Create Merton
Model Object
Use finmodel
to create a Merton
model object.
MertonModel = finmodel("Merton",'Volatility',0.45,'MeanJ',0.02,'JumpVol',0.07,'JumpFreq',0.09)
MertonModel = Merton with properties: Volatility: 0.4500 MeanJ: 0.0200 JumpVol: 0.0700 JumpFreq: 0.0900
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",MertonModel,'SpotPrice',102,'simulationDates',datetime(2022,9,15))
outPricer = MertonMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 102 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.Merton] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "standard" BrownianMotionMethod: "standard"
Price Binary
Instrument
Use price
to compute the price and sensitivities for the Binary
instrument.
[Price, outPR] = price(outPricer,BinaryOpt,["all"])
Price = 112.4515
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
______ _____ _____ ______ _______ ______ ____
112.45 0 0 0 -449.72 3.9384 0
Price Binary
Instrument Using Bachelier
Model and AssetMonteCarlo
Pricer
This example shows the workflow to price a Binary
instrument when you use a Bachelier
model and an AssetMonteCarlo
pricing method.
Create Binary
Instrument Object
Use fininstrument
to create a Binary
instrument object.
BinaryOpt = fininstrument("Binary",'ExerciseDate',datetime(2022,9,15),'Strike',1000,'PayoffValue',130,'OptionType',"put",'Name',"binary_option")
BinaryOpt = Binary with properties: OptionType: "put" ExerciseDate: 15-Sep-2022 Strike: 1000 PayoffValue: 130 ExerciseStyle: "european" Name: "binary_option"
Create Bachelier
Model Object
Use finmodel
to create a Bachelier
model object.
BachelierModel = finmodel("Bachelier",'Volatility',.2)
BachelierModel = Bachelier with properties: Volatility: 0.2000 Correlation: 1
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",BachelierModel,'SpotPrice',102,'simulationDates',datetime(2022,9,15))
outPricer = BachelierMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 102 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.Bachelier] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "standard" BrownianMotionMethod: "standard"
Price Binary
Instrument
Use price
to compute the price and sensitivities for the Binary
instrument.
[Price, outPR] = price(outPricer,BinaryOpt,["all"])
Price = 113.0166
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
______ _____ _____ ______ _______ ______ ____
113.02 0 0 0 -451.98 3.9582 0
Price Binary
Instrument Using BlackScholes
Model and BlackScholes
Pricer
This example shows the workflow to price a Binary
instrument when you use a BlackScholes
model and a BlackScholes
pricing method.
Create Binary
Instrument Object
Use fininstrument
to create a Binary
instrument object.
BinaryOpt = fininstrument("Binary",'ExerciseDate',datetime(2022,9,15),'Strike',1000,'PayoffValue',130,'OptionType',"put",'Name',"binary_option")
BinaryOpt = Binary with properties: OptionType: "put" ExerciseDate: 15-Sep-2022 Strike: 1000 PayoffValue: 130 ExerciseStyle: "european" Name: "binary_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',0.28)
BlackScholesModel = BlackScholes with properties: Volatility: 0.2800 Correlation: 1
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 BlackScholes
Pricer Object
Use finpricer
to create a BlackScholes
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("analytic",'DiscountCurve',myRC,'Model',BlackScholesModel,'SpotPrice',800,'DividendValue',0.045)
outPricer = BlackScholes with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 800 DividendValue: 0.0450 DividendType: "continuous"
Price Binary
Instrument
Use price
to compute the price and sensitivities for the Binary
instrument.
[Price, outPR] = price(outPricer,BinaryOpt,["all"])
Price = 87.4005
outPR = priceresult with properties: Results: [1x7 table] PricerData: []
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Vega Theta Rho
_____ _________ ___________ _______ _______ ______ _______
87.4 -0.075973 -3.1264e-05 -0.6954 -23.084 3.2599 -592.61
More About
Binary Option
A binary option is where the buyer receives a payout or loses their investment, depending on whether the option expires in the money.
A binary option is typically based on an underlying asset, such as stocks, currencies, commodities, or market indices. The option's value is derived from the price movement of the underlying asset.
Binary options depend on the outcome of a "yes or no" proposition, hence the name "binary." Binary options have an expiry date and/or time. At the time of expiry, the price of the underlying asset must be on the correct side of the strike price (based on the trade taken) for the trader to make a profit.
A binary option automatically exercises, meaning the gain or loss on the trade is automatically credited or debited to the trader's account when the option expires.
Version History
Introduced in R2020bR2024b: Support for RoughHeston
model and RoughVolMonteCarlo
pricer
The Binary
instrument object supports pricing with a RoughHeston
model and
a RoughVolMonteCarlo
pricing method.
R2024a: Support for RoughBergomi
model and RoughVolMonteCarlo
pricer
The Binary
instrument object supports pricing with a RoughBergomi
model
and a RoughVolMonteCarlo
pricing method.
R2022b: Serial date numbers not recommended
Although Binary
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 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)