Main Content

Binary

Binary instrument object

Since R2020b

Description

Create and price a Binary instrument object for one or more Binary instruments using this workflow:

  1. Use fininstrument to create a Binary instrument object for one or more Binary instruments.

  2. Use finmodel to specify a BlackScholes, RoughBergomi, or Bachelier model for the Binary instrument object.

  3. Choose a pricing method.

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

Description

example

BinaryOpt = fininstrument(InstrumentType,'Strike',strike_value,'ExerciseDate',exercise_date,'PayoffValue',payoff_value) creates a 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.

example

BinaryOpt = fininstrument(___,Name,Value) sets optional properties using additional name-value pair arguments in addition to the required arguments in the previous syntax. For example, 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

expand all

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

Name-Value Arguments

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

Required Binary Name-Value Pair Arguments

expand all

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

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.

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

Optional Binary Name-Value Pair Arguments

expand all

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

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

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

expand all

Option strike price value, returned as a scalar nonnegative value or an NINST-by-1 vector of nonnegative values.

Data Types: double

Option exercise date, returned as a datetime or an NINST-by-1 vector of datetimes.

Data Types: datetime

Option payoff value, returned as a scalar numeric value or an NINST-by-1 vector of numeric values.

Data Types: double

Option type, returned as a scalar string or an NINST-by-1 string array with the values of "call" or "put".

Data Types: string

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

User-defined name for the instrument, returned as a scalar string or an NINST-by-1 string array.

Data Types: string

Examples

collapse all

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  

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  

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  

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

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  

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  

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

expand all

Version History

Introduced in R2020b

expand all