# barrierbystt

Price barrier options using standard trinomial tree

## Syntax

``````[Price,PriceTree] = barrierbystt(STTTree,OptSpec,Strike,Settle,ExerciseDates,AmericanOpt,BarrierSpec,Barrier)``````
``````[Price,PriceTree] = barrierbystt(___,Name,Value)``````

## Description

example

``````[Price,PriceTree] = barrierbystt(STTTree,OptSpec,Strike,Settle,ExerciseDates,AmericanOpt,BarrierSpec,Barrier)``` prices barrier options using a standard trinomial (STT) tree.```

example

``````[Price,PriceTree] = barrierbystt(___,Name,Value)``` prices barrier options using a standard trinomial (STT) tree with an optional name-value pair argument for `Rebate` and `Options`.```

## Examples

collapse all

Create a `RateSpec`.

```StartDates = 'Jan-1-2009'; EndDates = 'Jan-1-2013'; Rates = 0.035; Basis = 1; Compounding = -1; RateSpec = intenvset('ValuationDate', StartDates, 'StartDates', StartDates,... 'EndDates', EndDates, 'Rates', Rates,'Compounding', Compounding, 'Basis', Basis)```
```RateSpec = struct with fields: FinObj: 'RateSpec' Compounding: -1 Disc: 0.8694 Rates: 0.0350 EndTimes: 4 StartTimes: 0 EndDates: 735235 StartDates: 733774 ValuationDate: 733774 Basis: 1 EndMonthRule: 1 ```

Create a `StockSpec`.

```AssetPrice = 85; Sigma = 0.15; StockSpec = stockspec(Sigma, AssetPrice)```
```StockSpec = struct with fields: FinObj: 'StockSpec' Sigma: 0.1500 AssetPrice: 85 DividendType: [] DividendAmounts: 0 ExDividendDates: [] ```

Create an `STTTree`.

```NumPeriods = 4; TimeSpec = stttimespec(StartDates, EndDates, 4); STTTree = stttree(StockSpec, RateSpec, TimeSpec)```
```STTTree = struct with fields: FinObj: 'STStockTree' StockSpec: [1x1 struct] TimeSpec: [1x1 struct] RateSpec: [1x1 struct] tObs: [0 1 2 3 4] dObs: [733774 734139 734504 734869 735235] STree: {1x5 cell} Probs: {[3x1 double] [3x3 double] [3x5 double] [3x7 double]} ```

Define the barrier option and compute the price.

```Settle = '1/1/09'; ExerciseDates = '1/1/12'; OptSpec = 'call'; Strike = 105; AmericanOpt = 1; BarrierSpec = 'UI'; Barrier = 115; Price= barrierbystt(STTTree, OptSpec, Strike, Settle, ExerciseDates,... AmericanOpt, BarrierSpec, Barrier)```
```Price = 3.7977 ```

## Input Arguments

collapse all

Stock tree structure for a standard trinomial tree, specified by using `stttree`.

Data Types: `struct`

Definition of option, specified as `'call'` or `'put'` using a character vector or a `NINST`-by-`1` cell array of character vectors for `'call'` or `'put'`.

Data Types: `char` | `cell`

European or American option strike price value, specified with a nonnegative integer using a `NINST`-by-`1` matrix of nonnegative numeric values. Each row is the schedule for one option. To compute the value of a floating-strike barrier option, `Strike` should be specified as `NaN`. Floating-strike barrier options are also known as average strike options.

Data Types: `double`

Settlement date or trade date for the barrier option, specified as a `NINST`-by-`1` matrix of settlement or trade dates using serial date numbers or date character vectors.

Note

The `Settle` date for every barrier option is set to the `ValuationDate` of the stock tree. The barrier argument, `Settle`, is ignored.

Data Types: `double` | `char` | `cell`

Option exercise dates, specified as a serial date number or date character vector:

• For a European option, use a`NINST`-by-`1` matrix of exercise dates. Each row is the schedule for one option. For a European option, there is only one `ExerciseDates` on the option expiry date.

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

Data Types: `double` | `char` | `cell`

Option type, specified as an `NINST`-by-`1` matrix of flags with values:

• `0` — European

• `1` — American

Data Types: `double`

Barrier option type, specified as a character vector or an `NINST`-by-`1` cell array of character vectors 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 or 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 or 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 or 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 or 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` | `cell`

Barrier levels, specified as an `NINST`-by-`1` matrix of numeric values.

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: `Price = barrierbystt(STTTree,OptSpec,Strike,Settle,ExerciseDates,1,'UI',115,'Rebate',25)`

Rebate values, specified as the comma-separated pair consisting of `'Rebate'` and a `NINST`-by-`1` matrix of numeric values. 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`

Derivatives pricing options, specified as the comma-separated pair consisting of `'Options'` and a structure that is created with `derivset`.

Data Types: `struct`

## Output Arguments

collapse all

Expected prices for barrier options at time 0, returned as a `NINST`-by-`1` matrix.

Structure with a vector of barrier option prices at each node, returned as a tree structure.

`PriceTree` is a MATLAB® structure of trees containing vectors of instrument prices and a vector of observation times for each node.

`PriceTree.PTree` contains the prices.

`PriceTree.tObs` contains the observation times.

`PriceTree.dObs` contains the observation dates.

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. For more information, see Barrier Option.

## References

[1] Derman, E., I. Kani, D. Ergener and I. Bardhan. “Enhanced Numerical Methods for Options with Barriers.” Financial Analysts Journal. (Nov.-Dec.), 1995, pp. 65–74.

## Version History

Introduced in R2015b