# naginterfaces.library.pde.dim1_​blackscholes_​closed¶

naginterfaces.library.pde.dim1_blackscholes_closed(kopt, x, s, t, tmat, tdpar, r, q, sigma)[source]

dim1_blackscholes_closed computes an analytic solution to the Black–Scholes equation for a certain set of option types.

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

https://www.nag.com/numeric/nl/nagdoc_27.3/flhtml/d03/d03ndf.html

Parameters
koptint

Specifies the kind of option to be valued:

A European call option.

An American call option.

A European put option.

xfloat

The exercise price .

sfloat

The stock price at which the option value and the Greeks should be evaluated.

tfloat

The time at which the option value and the Greeks should be evaluated.

tmatfloat

The maturity time of the option.

tdparbool, array-like, shape

Specifies whether or not various arguments are time-dependent. More precisely, is time-dependent if and constant otherwise. Similarly, specifies whether is time-dependent and specifies whether is time-dependent.

rfloat, array-like, shape

Note: the required length for this argument is determined as follows: if : ; otherwise: .

If then must contain the constant value of . The remaining elements need not be set.

If then must contain the value of at time and must contain its average instantaneous value over the remaining life of the option:

The auxiliary function dim1_blackscholes_means() may be used to construct from a set of values of at discrete times.

qfloat, array-like, shape

Note: the required length for this argument is determined as follows: if : ; otherwise: .

If then must contain the constant value of . The remaining elements need not be set.

If then must contain the constant value of and must contain its average instantaneous value over the remaining life of the option:

The auxiliary function dim1_blackscholes_means() may be used to construct from a set of values of at discrete times.

sigmafloat, array-like, shape

Note: the required length for this argument is determined as follows: if : ; otherwise: .

If then must contain the constant value of . The remaining elements need not be set.

If then must contain the value of at time , the average instantaneous value , and the second-order average , where:

The auxiliary function dim1_blackscholes_means() may be used to compute from a set of values at discrete times.

Returns
ffloat

The value of the option at the stock price and time .

thetafloat

The values of various Greeks at the stock price and time , as follows:

deltafloat

The values of various Greeks at the stock price and time , as follows:

gammafloat

The values of various Greeks at the stock price and time , as follows:

lamdafloat

The values of various Greeks at the stock price and time , as follows:

rhofloat

The values of various Greeks at the stock price and time , as follows:

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, is not equal to with American call option. .

(errno )

On entry, .

Constraint: , or .

Notes

dim1_blackscholes_closed computes an analytic solution to the Black–Scholes equation (see Hull (1989) and Wilmott et al. (1995))

for the value of a European put or call option, or an American call option with zero dividend . In equation (1) is time, is the stock price, is the exercise price, is the risk free interest rate, is the continuous dividend, and is the stock volatility. The parameter , and may be either constant, or functions of time. In the latter case their average instantaneous values over the remaining life of the option should be provided to dim1_blackscholes_closed. An auxiliary function dim1_blackscholes_means() is available to compute such averages from values at a set of discrete times. Equation (1) is subject to different boundary conditions depending on the type of option. For a call option the boundary condition is

where is the maturity time of the option. For a put option the equation (1) is subject to

dim1_blackscholes_closed also returns values of the Greeks

specfun.opt_bsm_greeks also computes the European option price given by the Black–Scholes–Merton formula together with a more comprehensive set of sensitivities (Greeks).

Further details of the analytic solution returned are given in Algorithmic Details.

References

Hull, J, 1989, Options, Futures and Other Derivative Securities, Prentice–Hall

Wilmott, P, Howison, S and Dewynne, J, 1995, The Mathematics of Financial Derivatives, Cambridge University Press