naginterfaces.library.specfun.opt_​barrier_​std_​price

naginterfaces.library.specfun.opt_barrier_std_price(calput, btype, x, s, h, k, t, sigma, r, q)[source]

opt_barrier_std_price computes the price of a standard barrier option.

For full information please refer to the NAG Library document for s30fa

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/s/s30faf.html

Parameters
calputstr, length 1

Determines whether the option is a call or a put.

A call; the holder has a right to buy.

A put; the holder has a right to sell.

btypestr, length 2

Indicates the barrier type as In or Out and its relation to the price of the underlying asset as Up or Down.

Down-and-In.

Down-and-Out.

Up-and-In.

Up-and-Out.

xfloat, array-like, shape

must contain , the th strike price, for .

sfloat

, the price of the underlying asset.

hfloat

The barrier price.

kfloat

The value of a possible cash rebate to be paid if the option has not been knocked in (or out) before expiration.

tfloat, array-like, shape

must contain , the th time, in years, to expiry, for .

sigmafloat

, the volatility of the underlying asset. Note that a rate of 15% should be entered as .

rfloat

, the annual risk-free interest rate, continuously compounded. Note that a rate of 5% should be entered as .

qfloat

, the annual continuous yield rate. Note that a rate of 8% should be entered as .

Returns
pfloat, ndarray, shape

contains , the option price evaluated for the strike price at expiry for and .

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: and .

(errno )

On entry, .

Constraint: and .

(errno )

On entry, .

Constraint: and .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and are inconsistent with : and .

Notes

opt_barrier_std_price computes the price of a standard barrier option, where the exercise, for a given strike price, , depends on the underlying asset price, , reaching or crossing a specified barrier level, . Barrier options of type In only become active (are knocked in) if the underlying asset price attains the pre-determined barrier level during the lifetime of the contract. Those of type Out start active and are knocked out if the underlying asset price attains the barrier level during the lifetime of the contract. A cash rebate, , may be paid if the option is inactive at expiration. The option may also be described as Up (the underlying price starts below the barrier level) or Down (the underlying price starts above the barrier level). This gives the following options which can be specified as put or call contracts.

Down-and-In: the option starts inactive with the underlying asset price above the barrier level. It is knocked in if the underlying price moves down to hit the barrier level before expiration.

Down-and-Out: the option starts active with the underlying asset price above the barrier level. It is knocked out if the underlying price moves down to hit the barrier level before expiration.

Up-and-In: the option starts inactive with the underlying asset price below the barrier level. It is knocked in if the underlying price moves up to hit the barrier level before expiration.

Up-and-Out: the option starts active with the underlying asset price below the barrier level. It is knocked out if the underlying price moves up to hit the barrier level before expiration.

The payoff is for a call or for a put, if the option is active at expiration, otherwise it may pay a pre-specified cash rebate, . Following Haug (2007), the prices of the various standard barrier options can be written as shown below. The volatility, , risk-free interest rate, , and annualised dividend yield, , are constants. The integer parameters, and , take the values , depending on the type of barrier.

with

and where denotes the cumulative Normal distribution function,

Down-and-In ( ):

When , with ,

and with ,

When , with

and with ,

Down-and-Out ( ):

When , with ,

and with ,

When , with ,

and with ,

Up-and-In ( ):

When , with , ,

and with ,

When , with , ,

and with ,

Up-and-Out ( ):

When , with , ,

and with ,

When , with , ,

and with ,

The option price is computed for each strike price in a set , , and for each expiry time in a set , .

References

Haug, E G, 2007, The Complete Guide to Option Pricing Formulas, (2nd Edition), McGraw-Hill