naginterfaces.library.specfun.opt_bsm_greeks¶
- naginterfaces.library.specfun.opt_bsm_greeks(calput, x, s, t, sigma, r, q)[source]¶
opt_bsm_greeks
computes the European option price given by the Black–Scholes–Merton formula together with its sensitivities (Greeks).For full information please refer to the NAG Library document for s30ab
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/s/s30abf.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.
- xfloat, array-like, shape
must contain , the th strike price, for .
- sfloat
, the price of the underlying asset.
- 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 .
- deltafloat, ndarray, shape
The leading part of the array contains the sensitivity, , of the option price to change in the price of the underlying asset.
- gammafloat, ndarray, shape
The leading part of the array contains the sensitivity, , of to change in the price of the underlying asset.
- vegafloat, ndarray, shape
, contains the first-order Greek measuring the sensitivity of the option price to change in the volatility of the underlying asset, i.e., , for and .
- thetafloat, ndarray, shape
, contains the first-order Greek measuring the sensitivity of the option price to change in time, i.e., , for and , where .
- rhofloat, ndarray, shape
, contains the first-order Greek measuring the sensitivity of the option price to change in the annual risk-free interest rate, i.e., , for and .
- crhofloat, ndarray, shape
, contains the first-order Greek measuring the sensitivity of the option price to change in the annual cost of carry rate, i.e., , for and , where .
- vannafloat, ndarray, shape
, contains the second-order Greek measuring the sensitivity of the first-order Greek to change in the volatility of the asset price, i.e., , for and .
- charmfloat, ndarray, shape
, contains the second-order Greek measuring the sensitivity of the first-order Greek to change in the time, i.e., , for and .
- speedfloat, ndarray, shape
, contains the third-order Greek measuring the sensitivity of the second-order Greek to change in the price of the underlying asset, i.e., , for and .
- colourfloat, ndarray, shape
, contains the third-order Greek measuring the sensitivity of the second-order Greek to change in the time, i.e., , for and .
- zommafloat, ndarray, shape
, contains the third-order Greek measuring the sensitivity of the second-order Greek to change in the volatility of the underlying asset, i.e., , for and .
- vommafloat, ndarray, shape
, contains the second-order Greek measuring the sensitivity of the first-order Greek to change in the volatility of the underlying asset, i.e., , for and .
- Raises
- NagValueError
- (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: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- Notes
opt_bsm_greeks
computes the price of a European call (or put) option together with the Greeks or sensitivities, which are the partial derivatives of the option price with respect to certain of the other input parameters, by the Black–Scholes–Merton formula (see Black and Scholes (1973) and Merton (1973)). The annual volatility, , risk-free interest rate, , and dividend yield, , must be supplied as input. For a given strike price, , the price of a European call with underlying price, , and time to expiry, , isand the corresponding European put price is
and where denotes the cumulative Normal distribution function,
and
The option price is computed for each strike price in a set , , and for each expiry time in a set , .
- References
Black, F and Scholes, M, 1973, The pricing of options and corporate liabilities, Journal of Political Economy (81), 637–654
Merton, R C, 1973, Theory of rational option pricing, Bell Journal of Economics and Management Science (4), 141–183