Barrier

Barrier instrument object

Description

Create and price a Barrier instrument object using this workflow:

  1. Use fininstrument to create a Barrier instrument object.

  2. Use finmodel to specify a BlackScholes model for the Barrier instrument.

  3. Use finpricer to specify a FiniteDifference or BlackScholes pricing method for the Barrier 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 Barrier instrument, see Choose Instruments, Models, and Pricers.

Creation

Description

example

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

example

BarrierOpt = fininstrument(___,Name,Value) sets optional properties using additional name-value pairs in addition to the required arguments in the previous syntax. For example, BarrierOpt = fininstrument("Barrier",'Strike',100,'ExerciseDate',datetime(2019,1,30),'BarrierValue',110,'OptionType',"put",'ExerciseStyle',"European",'BarrierType',"DO",'Name',"barrier_option") creates a Barrier put option with an European exercise. You can specify multiple name-value pair arguments.

Input Arguments

expand all

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

Data Types: char | string

Barrier 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: BarrierOpt = fininstrument("Barrier",'Strike',100,'ExerciseDate',datetime(2019,1,30),'BarrierValue',110,'OptionType',"put",'ExerciseStyle',"European",'BarrierType',"DO",'Name',"barrier_option")

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

Barrier level, specified as the comma-separated pair consisting of 'BarrierLevel' and a scalar numeric value.

Data Types: double

Optional Barrier 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 Barrier option, the BlackScholes pricer supports only a "European" exercise and the FiniteDifference pricer supports an "American" or "European" exercise.

Data Types: string | char

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

  • "UI" — Up knock-in

    This option becomes effective when the price of the underlying asset passes above the barrier level. If the underlying asset goes above the barrier level during the life of the option, the option holder has the right, but not the obligation, to buy or sell (call or put) the underlying security at the strike price.

  • "UO" — Up knock-out

    This option gives the option holder the right, but not the obligation, to buy or sell (call or put) the underlying security at the strike price as long as the underlying asset does not go above the barrier level during the life of the option. This option terminates when the price of the underlying security passes above the barrier level. If the spot price of the underlying asset reaches or exceeds the barrier level with an up-and-out option, the rebate is paid.

  • "DI" — Down knock-in

    This option becomes effective when the price of the underlying stock passes below the barrier level. If the underlying security goes below the barrier level during the life of the option, the option holder has the right, but not the obligation, to buy or sell (call or put) the underlying security at the strike price. With a down-and-in option, the rebate is paid if the spot price of the underlying does not reach the barrier level during the life of the option. Note that a Barrier instrument using the FiniteDifference pricer does not support American knock-in barrier options.

  • "DO" — Down knock-up

    This option gives the option holder the right, but not the obligation, to buy or sell (call or put) the underlying asset at the strike price as long as the underlying asset does not go below the barrier level during the life of the option. This option terminates when the price of the underlying security passes below the barrier level. If the option is worthless when it expires, the option holder receives a rebate amount.

OptionBarrier TypePayoff If Barrier CrossedPayoff If Barrier Not Crossed
Call or PutDown knock-outWorthlessStandard Call or Put
Call or PutDown knock-inCall or PutWorthless
Call or PutUp knock-outWorthlessStandard Call or Put
Call or PutUp knock-inStandard Call or PutWorthless

Data Types: char | string

Rebate value, specified as the comma-separated pair consisting of 'Rebate' and a scalar numeric.

  • For knock-in options, the Rebate is paid at expiry.

  • For knock-out options, the Rebate is paid when BarrierValue is reached.

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

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

Barrier option type, returned as a string with a value of "UI", "UO", "DI", or "DO".

Data Types: string

Barrier level, returned as a scalar numeric value.

Data Types: double

Rebate value, returned as a scalar numeric.

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 Barrier instrument when you use a BlackScholes model and a FiniteDifference pricing method.

Create Barrier Instrument Object

Use fininstrument to create an Barrier instrument object.

BarrierOpt = fininstrument("Barrier",'Strike',45,'ExerciseDate',datetime(2019,1,1),'OptionType',"call",'ExerciseStyle',"american",'BarrierType',"DO",'BarrierValue',40,'Name',"barrier_option")
BarrierOpt = 
  Barrier with properties:

       OptionType: "call"
           Strike: 45
      BarrierType: "do"
     BarrierValue: 40
           Rebate: 0
    ExerciseStyle: "american"
     ExerciseDate: 01-Jan-2019
             Name: "barrier_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',50)
outPricer = 
  FiniteDifference with properties:

     DiscountCurve: [1x1 ratecurve]
             Model: [1x1 finmodel.BlackScholes]
         SpotPrice: 50
    GridProperties: [1x1 struct]
      DividendType: "continuous"
     DividendValue: 0

Price Barrier Instrument

Use price to compute the price and sensitivities for the Barrier instrument.

[Price, outPR] = price(outPricer,BarrierOpt,["all"])
Price = 8.5014
outPR = 
  priceresult with properties:

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

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

    8.5014    0.85673    0.0057199    5.0388    -1.8461    26.238    6.1837

More About

expand all

Tips

After creating an Barrier instrument object with an ExerciseStyle set to"American", you can modify the ExerciseStyle property to change it to "European" using dot notation.

Barrier.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 Strike and ExerciseDate values.

Introduced in R2020a