# dblbarriersensbyfd

Calculate double barrier option price and sensitivities using finite difference method

## Description

example

[PriceSens,PriceGrid,AssetPrices,Times] = dblbarriersensbyfd(RateSpec,StockSpec,OptSpec,Strike,Settle,ExerciseDates,BarrierSpec,Barrier) calculates a European or American call or put double barrier option price and sensitivities of a single underlying asset using the finite difference method. dblbarrierbyfd assumes that the barrier is continuously monitored.

example

[PriceSens,PriceGrid,AssetPrices,Times] = dblbarriersensbyfd(___,Name,Value) specifies options using one or more name-value pair arguments in addition to the input arguments in the previous syntax.

## Examples

collapse all

Compute the price and sensitivities for an American double barrier option for a double knock-out (down and out-up and out) call option with a rebate using the following data:

Rate = 0.05;
Settle = '01-Jun-2018';
Maturity = '01-Dec-2018';
Basis = 1;

Define a RateSpec.

RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, 'EndDates', Maturity,'Rates', Rate, 'Compounding', -1, 'Basis', Basis);

Define a StockSpec.

AssetPrice = 100;
Volatility = 0.25;
StockSpec = stockspec(Volatility, AssetPrice);

Define the double barrier option.

LBarrier = 80;
UBarrier = 130;
Barrier = [UBarrier LBarrier];
BarrierSpec = 'DKO';
OptSpec = 'Call';
Strike = 110;
Rebate = 1;
OutSpec = {'price'; 'vega'; 'theta'};

Compute the price and sensitivities for an American option using finite differences.

[Price, Vega, Theta] = dblbarriersensbyfd(RateSpec, StockSpec, OptSpec, Strike, Settle, Maturity, BarrierSpec, Barrier,'Rebate', Rebate, 'AmericanOpt', 1,'Outspec', OutSpec)
Price = 4.0002
Vega = -1.9180e+03
Theta = -6.6509

## 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, specified by the StockSpec obtained from 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, specified as a character vector with a value of 'call' or 'put', or a string scalar with values "call" or "put".

Data Types: char | string

Option strike price value, specified as a scalar numeric.

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

Option exercise dates, specified as a serial date number, a date character vector, or datetime object.

• For a European option, the option expiry date has only one ExerciseDates value.

• 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. If only one non-NaN date is listed, the option can be exercised between Settle and the single listed date in ExerciseDates.

Data Types: double | char | datetime

Double barrier option type, specified as a 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 level, specified as a 1-by-2 vector of numeric values, where the first column is the upper barrier (1)(UB) and the second column is the lower barrier (2)(LB). Barrier(1) must be greater than Barrier(2).

Data Types: double

### Name-Value Arguments

Specify 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: PriceSens = dblbarriersensbyfd(RateSpec,StockSpec,OptSpec,Strike,Settle,Maturity,BarrierSpec,Barrier,'OutSpec',{'delta','gamma','vega','lambda','rho','theta','price'},'AmericanOpt',1)

Define outputs, specified as the comma-separated pair consisting of 'OutSpec' and a NOUT- by-1 or a 1-by-NOUT cell array of character vectors or a string array 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 | string

Rebate value, specified as the comma-separated pair consisting of 'Rebate' and one of the following:

• For a Double Knock-out option, use a 1-by-2 vector of rebate values where the first column is the payout if the upper barrier(1)(UB) is hit and the second column is payout if the lower barrier(2)(LB) is hit. The rebate is paid when the barrier is reached.

• For a Double Knock-in option, use a scalar rebate value. The rebate is paid at expiry.

Data Types: double

Size of the asset grid used for the finite difference grid, specified as the comma-separated pair consisting of 'AssetGridSize' and a positive scalar numeric.

Data Types: double

Size of the time grid used for the finite difference grid, specified as the comma-separated pair consisting of 'TimeGridSize' and a positive scalar numeric.

Note

The actual time grid may have a larger size because exercise and ex-dividend dates might be added to the grid from StockSpec.

Data Types: double

Option type, specified as the comma-separated pair consisting of 'AmericanOpt' and a scalar flag with one of the following values:

• 0 — European

• 1 — American

Data Types: logical

## Output Arguments

collapse all

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

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

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.

collapse all

### Double Barrier Option

A double barrier option is similar to the standard single barrier option except that it has two barrier levels: a lower barrier (LB) and an upper barrier (UB).

The payoff for a double barrier option depends on whether the underlying asset remains between the barrier levels during the life of the option. Double barrier options are less expensive than single barrier options as they have a higher knock-out probability. Because of this, double barrier options allow investors to reduce option premiums and match an investor’s belief about the future movement of the underlying price process.

## References

[1] Boyle, P., and Y. Tian. “An Explicit Finite Difference Approach to the Pricing of Barrier Options.” Applied Mathematical Finance. Vol. 5, Number 1, 1998, pp. 17–43.

[2] Hull, J. Options, Futures, and Other Derivatives. Fourth Edition. Upper Saddle River, NJ: Prentice Hall, 2000, pp. 646–649.

[3] Rubinstein, M., and E. Reiner. “Breaking Down the Barriers.” Risk. Vol. 4, Number 8, 1991, pp. 28–35.

[4] Zvan, R., P. A. Forsyth and K. R. Vetzal. “PDE Methods for Pricing Barrier Options.” Journal of Economic Dynamics and Control. Vol. 24, Number 11-12, 2000, pp. 1563–1590.

## Version History

Introduced in R2019a