Main Content

DoubleBarrier

DoubleBarrier instrument object

Since R2020b

Description

Create and price a DoubleBarrier instrument object for one of more Double Barrier instruments using this workflow:

  1. Use fininstrument to create a DoubleBarrier instrument object for one of more Double Barrier instruments.

  2. Use finmodel to specify a BlackScholes, Heston, Bates, or Merton model for the DoubleBarrier 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 DoubleBarrier instrument, see Choose Instruments, Models, and Pricers.

Creation

Description

DoubleBarrierOpt = fininstrument(InstrumentType,'Strike',strike_value,'ExerciseDate',exercise_date,'BarrierValue',barrier_value) creates a 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.

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.

example

Input Arguments

expand all

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

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: 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 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.

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.

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 or an NINST-by-1 cell array of character vectors or string array.

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.

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

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

Double barrier value, returned as a numeric matrix.

Data Types: double

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

Data Types: string

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

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

Barrier rebate, returned as a numeric matrix.

Data Types: double

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

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

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   

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

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.

Version History

Introduced in R2020b

expand all