Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

barriersensbyfd

Calculate barrier option prices or sensitivities using finite difference method

Syntax

[PriceSens,PriceGrid,AssetPrices,Times] = barriersensbyfd(RateSpec,StockSpec,OptSpec,Strike,Settle,ExerciseDates,BarrierSpec,Barrier)
[PriceSens,PriceGrid,AssetPrices,Times] = barriersensbyfd(___,Name,Value)

Description

example

[PriceSens,PriceGrid,AssetPrices,Times] = barriersensbyfd(RateSpec,StockSpec,OptSpec,Strike,Settle,ExerciseDates,BarrierSpec,Barrier) calculates barrier option prices or sensitivities of a single underlying asset using the finite difference method. barrierbyfd assumes that the barrier is continuously monitored. barriersesbyfd does not support American knock-in barrier options.

example

[PriceSens,PriceGrid,AssetPrices,Times] = barriersensbyfd(___,Name,Value) adds optional name-value pair arguments. barriersesbyfd assumes that the barrier is continuously monitored. barriersensbyfd does not support American knock-in barrier options.

Examples

collapse all

Create a RateSpec.

AssetPrice = 50;
Strike = 45;
Rate = 0.035;
Volatility = 0.30;
Settle = '01-Jan-2015';
Maturity = '01-Jan-2016';
Basis = 1;
 
RateSpec = intenvset('ValuationDate',Settle,'StartDates',Settle,'EndDates',...
Maturity,'Rates',Rate,'Compounding',-1,'Basis',Basis)
RateSpec = struct with fields:
           FinObj: 'RateSpec'
      Compounding: -1
             Disc: 0.9656
            Rates: 0.0350
         EndTimes: 1
       StartTimes: 0
         EndDates: 736330
       StartDates: 735965
    ValuationDate: 735965
            Basis: 1
     EndMonthRule: 1

Create a StockSpec.

StockSpec = stockspec(Volatility,AssetPrice)
StockSpec = struct with fields:
             FinObj: 'StockSpec'
              Sigma: 0.3000
         AssetPrice: 50
       DividendType: []
    DividendAmounts: 0
    ExDividendDates: []

Calculate the Price, Delta, and Theta of a European Down and Out call option using the finite difference method.

Barrier = 40;
BarrierSpec = 'DO';
OptSpec = 'Call';
OutSpec = {'price';'delta';'theta'};
[Price, Delta, Theta] = barriersensbyfd(RateSpec,StockSpec,OptSpec,Strike,Settle,...
Maturity, BarrierSpec,Barrier,'Outspec',OutSpec)
Price = 8.5021
Delta = 0.8568
Theta = -1.8501

Input Arguments

collapse all

Interest-rate term structure (annualized and continuously compounded), specified by the RateSpec obtained from intenvset. For information on the interest-rate specification, see intenvset.

Data Types: struct

Stock specification for the underlying asset. For information on the stock specification, see stockspec.

stockspec handles several types of underlying assets. For example, for physical commodities the price is StockSpec.Asset, the volatility is StockSpec.Sigma, and the convenience yield is StockSpec.DividendAmounts.

Data Types: struct

Definition of an option as 'call' or 'put', specified as a character vector or string object with values 'call' or 'put'.

Data Types: char | double

Option strike price value, specified as an integer.

Data Types: double

Settlement or trade date for the barrier option, specified as a serial date number, a date character vector, or a datetime object.

Data Types: double | char

Option exercise dates, specified as a nonnegative scalar integer, a date character vector, or datetime object:

  • For a European option, use a 1-by-1 vector of dates. For a European option, there is only one ExerciseDates on the option expiry date which is the maturity of the instrument.

  • For an American option, use a 1-by-2 vector of exercise date boundaries. The option can be exercised on any date between or including the pair of dates on that row. If only one non-NaN date is listed, or if ExerciseDates is a 1-by-1 vector of serial date numbers or a cell array of date character vectors, the option can be exercised between Settle and the single listed date in ExerciseDates.

Data Types: double | char

Barrier option type, specified as a character vector with the following values:

  • 'UI' — Up Knock In

    This option becomes effective when the price of the underlying asset passes above the barrier level. It gives the option holder the right, but not the obligation, to buy/sell (call/put) the underlying security at the strike price if the underlying asset goes above the barrier level during the life of the option. Note, barrierbyfd does not support American knock-in barrier options.

  • 'UO' — Up Knock Out

    This option gives the option holder the right, but not the obligation, to buy/sell (call/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 asset passes above the barrier level. Usually, with an up-and-out option, the rebate is paid if the spot price of the underlying reaches or exceeds the barrier level.

  • 'DI' — Down Knock In

    This option becomes effective when the price of the underlying stock passes below the barrier level. It gives the option holder the right, but not the obligation, to buy/sell (call/put) the underlying security at the strike price if the underlying security goes below the barrier level during the life of the option. 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, barrierbyfd 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/sell (call/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. Usually the option holder receives a rebate amount if the option expires worthless.

OptionBarrier TypePayoff if Barrier CrossedPayoff if Barrier not Crossed
Call/PutDown Knock-outWorthlessStandard Call/Put
Call/PutDown Knock-inCall/PutWorthless
Call/PutUp Knock-outWorthlessStandard Call/Put
Call/PutUp Knock-inStandard Call/PutWorthless

Data Types: char

Barrier value, specified as a scalar integer.

Data Types: double

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: PriceSens = barriersensbyfd(RateSpec,StockSpec,OptSpec,Strike,Settle,Maturity,BarrierSpec,Barrier,Rebate,1000,AmericanOpt,1)

collapse all

Rebate value, specified as a scalar integer. For Knock In options, the rebate is paid at expiry. For Knock Out options, the rebate is paid when the barrier is reached.

Data Types: double

Define outputs, specifying a NOUT- by-1 or a 1-by-NOUT cell array of character vectors with possible values of 'Price', 'Delta', 'Gamma', 'Vega', 'Lambda', 'Rho', 'Theta', and 'All'.

OutSpec = {'All'} specifies that the output is Delta, Gamma, Vega, Lambda, Rho, Theta, and Price, in that order. This is the same as specifying OutSpec to include each sensitivity.

Example: OutSpec = {'delta','gamma','vega','lambda','rho','theta','price'}

Data Types: char | cell

Size of the asset grid used for a finite difference grid, specified as a positive scalar.

Data Types: double

Size of the time grid used for a finite difference grid, specified as a positive scalar.

Data Types: double

Option type, specified as NINST-by-1 positive integer scalar flags with values:

  • 0 — European

  • 1 — American

Note

barriersensbyfd does not support American knock-in barrier options.

Data Types: double

Output Arguments

collapse all

Expected prices or sensitivities (defined using OutSpec) for barrier options, returned as a NINST-by-1 matrix.

Grid containing prices calculated by the finite difference method, returned as a two-dimensional grid with size PriceGridSize*length(Times). The number of columns does not have to be equal to the TimeGridSize, because ex-dividend dates in the StockSpec are added to the time grid. The price for t = 0 is contained in PriceGrid(:, end).

Prices of the asset defined by the StockSpec corresponding to the first dimension of PriceGrid, returned as a vector.

Times corresponding to the second dimension of the PriceGrid, returned as a vector.

Limitations

barriersensbyfd does not support American knock-in barrier options.

More About

collapse all

Barrier Option

A Barrier option has not only a strike price but also a barrier level and sometimes a rebate.

A rebate is a fixed amount that is paid if the option cannot be exercised because the barrier level has been reached or not reached. The payoff for this type of option depends on whether the underlying asset crosses the predetermined trigger value (barrier level), indicated by Barrier, during the life of the option.

References

[1] Hull, J. Options, Futures and Other Derivatives. Fourth Edition. Prentice Hall, 2000, pp. 646–649.

[2] Aitsahlia, F., L. Imhof, and T.L. Lai. “Pricing and hedging of American knock-in options.” The Journal of Derivatives. Vol. 11.3 , 2004, pp. 44–50.

[3] Rubinstein M. and E. Reiner. “Breaking down the barriers.” Risk. Vol. 4(8), 1991, pp. 28–35.

Introduced in R2016b

Was this topic helpful?