Main Content

DoubleBarrier

DoubleBarrier instrument object

Description

Create and price a DoubleBarrier instrument object using this workflow:

  1. Use fininstrument to create a DoubleBarrier instrument object.

  2. Use finmodel to specify a BlackScholes, Heston, Bates, or Merton model for the DoubleBarrier instrument.

  3. When using a BlackScholes model, use finpricer to specify an IkedaKunitomo or VannaVolga pricing method for the DoubleBarrier instrument.

    When using a BlackScholes, Heston, Bates, or Merton model, use finpricer to specify a FiniteDifference or an AssetMonteCarlo pricing method for the DoubleBarrier instrument.

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

Description

example

DoubleBarrierOpt = fininstrument(InstrumentType,'Strike',strike_value,'ExerciseDate',exercise_date,'BarrierValue',barrier_value) creates a DoubleBarrier object by specifying InstrumentType and sets properties using the required name-value pair arguments Strike, ExerciseDate, and BarrierValue.

example

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

expand all

Instrument type, specified as a string with the value of "DoubleBarrier" or a character vector with the value 'DoubleBarrier'.

Data Types: char | string

DoubleBarrier Name-Value Pair Arguments

Specify required and 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.

Example: DoubleBarrierOpt = fininstrument("DoubleBarrier",'Strike',100,'ExerciseDate',datetime(2019,1,30),'BarrierValue',110,'OptionType',"put",'ExerciseStyle',"European",'BarrierType',"DKI",'Name',"doublebarrier_option")
Required DoubleBarrier Name-Value Pair Arguments

expand all

Option strike price value, specified as the comma-separated pair consisting of 'Strike' and a scalar nonnegative value.

Data Types: double

Option exercise date, specified as the comma-separated pair consisting of 'ExerciseDate' and a scalar datetime, serial date number, date character vector, or date string.

Note

For a European option, there is only one ExerciseDate value on the option expiry date.

If you use a date character vector or date string, the format must be recognizable by datetime because the ExerciseDate property is stored as a datetime.

Data Types: double | char | string | datetime

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

Optional DoubleBarrier Name-Value Pair Arguments

expand all

Option type, specified as the comma-separated pair consisting of 'OptionType' and a scalar string or character vector.

Data Types: char | string

Option exercise style, specified as the comma-separated pair consisting of 'ExerciseStyle' and a scalar string or character vector.

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

Double barrier type, specified as the comma-separated pair consisting of 'BarrierType' and a scalar character vector or string with one of the following values:

  • 'DKI' — Double knock-in

    The '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-out

    The '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.

OptionBarrier TypePayoff If Any Barrier CrossedPayoff If Barriers Not Crossed
Call/PutDouble Knock-inStandard Call/PutWorthless
Call/PutDouble Knock-outWorthlessStandard Call/Put

Data Types: char | string

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

User-defined name for the instrument, specified as the comma-separated pair consisting of 'Name' and a scalar string or character vector.

Data Types: char | string

Properties

expand all

Option strike price value, returned as a scalar nonnegative value.

Data Types: double

Option exercise date, returned as a datetime.

Data Types: datetime

Double barrier value, returned as a numeric matrix.

Data Types: double

Option type, returned as a string with the value "call" or "put".

Data Types: string

Option exercise style, returned as a string with the value of "European" or "American".

Data Types: string

Double barrier type, returned as a character vector or string.

Data Types: string

Barrier rebate, returned as a numeric matrix.

Data Types: double

User-defined name for the instrument, returned as a string.

Data Types: string

Examples

collapse all

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  

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

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

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("15-Sep-2017");
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.9563
outPR = 
  priceresult with properties:

       Results: [1x7 table]
    PricerData: [1x1 struct]

outPR.Results 
ans=1×7 table
    Price      Delta      Gamma      Lambda      Rho       Theta      Vega 
    ______    _______    ________    ______    _______    _______    ______

    6.9563    0.23644    -0.11701    3.399     0.14976    -99.727    -8.344

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

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

expand all

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"
Because a European option has a scalar 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.

Introduced in R2020b