module jetblack_options.european.generalised_black_scholes
Summary
Black-Scholes-Merton options pricing formulae.
Description
This is the "generalised" version using "cost of carry" (variable b).
The cost of carry rate (b) is:
- b == r: for non dividend paying stocks
- b == r - q: For dividend paying stocks where the dividend yield is q
- b == 0: for futures options
- b = r - rj: for currency options.
function jetblack_options.european.generalised_black_scholes.break_even_probability
jetblack_options.european.generalised_black_scholes.break_even_probability(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.carry
Summary
Sensitivity to the cost of carry.
jetblack_options.european.generalised_black_scholes.carry(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
True for a call, false for a put.
S: float
K: float
T: float
The time to expiry in years.
r: float
b: float
v: float
Returns
float:
The carry.
function jetblack_options.european.generalised_black_scholes.charm
Summary
Measures the instantaneous rate of change of delta over the passage of
Description
time.
Also known as DdeltaDtime.
jetblack_options.european.generalised_black_scholes.charm(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
True for a call, false for a put.
S: float
K: float
T: float
The time to expiry in years.
r: float
b: float
v: float
Returns
float:
The charm.
function jetblack_options.european.generalised_black_scholes.ddelta_dvol_dvol
jetblack_options.european.generalised_black_scholes.ddelta_dvol_dvol(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.delta
Summary
The sensitivity of the option to a change in the asset price.
jetblack_options.european.generalised_black_scholes.delta(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
True for a call, false for a put.
S: float
K: float
T: float
The time to expiry of the option in years.
r: float
b: float
The cost of carry of the asset.
v: float
The volatility of the asset.
Returns
float:
The delta.
function jetblack_options.european.generalised_black_scholes.delta_from_in_the_money_prob
jetblack_options.european.generalised_black_scholes.delta_from_in_the_money_prob(
is_call: bool,
T: float,
r: float,
b: float,
v: float,
in_the_money_prob: float
) -> float
Parameters
is_call: bool
T: float
r: float
b: float
v: float
in_the_money_prob: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.delta_mirror_call_put_strike
jetblack_options.european.generalised_black_scholes.delta_mirror_call_put_strike(
S: float,
K: float,
T: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.delta_mirror_strike
jetblack_options.european.generalised_black_scholes.delta_mirror_strike(
S: float,
T: float,
b: float,
v: float
) -> float
Parameters
S: float
T: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.dgamma_dspot
jetblack_options.european.generalised_black_scholes.dgamma_dspot(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.dgamma_dtime
jetblack_options.european.generalised_black_scholes.dgamma_dtime(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.dgamma_dvol
jetblack_options.european.generalised_black_scholes.dgamma_dvol(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.dgammap_dspot
jetblack_options.european.generalised_black_scholes.dgammap_dspot(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.dgammap_dtime
jetblack_options.european.generalised_black_scholes.dgammap_dtime(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.dgammap_dvol
jetblack_options.european.generalised_black_scholes.dgammap_dvol(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.dvega_dtime
jetblack_options.european.generalised_black_scholes.dvega_dtime(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.dvegap_dvol
jetblack_options.european.generalised_black_scholes.dvegap_dvol(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.dvomma_dvol
jetblack_options.european.generalised_black_scholes.dvomma_dvol(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.dzeta_dtime
jetblack_options.european.generalised_black_scholes.dzeta_dtime(
is_call: bool,
S: float,
K: float,
T: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.dzeta_dvol
jetblack_options.european.generalised_black_scholes.dzeta_dvol(
is_call: bool,
S: float,
K: float,
T: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.elasticity
Summary
The percentage change in the option price for a percentage change in the
Description
asset price.
This is thought of as a measure of leverage, sometimes called gearing.
Also known as lambda or omega.
jetblack_options.european.generalised_black_scholes.elasticity(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
True for a call, false for a put.
S: float
K: float
T: float
The time to expiry in years.
r: float
b: float
v: float
Returns
float:
The elasticity.
function jetblack_options.european.generalised_black_scholes.forward_delta
jetblack_options.european.generalised_black_scholes.forward_delta(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.futures_rho
jetblack_options.european.generalised_black_scholes.futures_rho(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.gamma
Summary
The second derivative to the change in the asset price.
jetblack_options.european.generalised_black_scholes.gamma(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
The time to expiry of the option in years.
r: float
b: float
The cost of carry of the asset.
v: float
The volatility of the asset.
Returns
float:
The gamma.
function jetblack_options.european.generalised_black_scholes.gamma_from_delta
jetblack_options.european.generalised_black_scholes.gamma_from_delta(
S: float,
T: float,
r: float,
b: float,
v: float,
delta_: float
) -> float
Parameters
S: float
T: float
r: float
b: float
v: float
delta_: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.gammap
jetblack_options.european.generalised_black_scholes.gammap(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.gammap_from_delta
jetblack_options.european.generalised_black_scholes.gammap_from_delta(
S: float,
T: float,
r: float,
b: float,
v: float,
delta_: float
) -> float
Parameters
S: float
T: float
r: float
b: float
v: float
delta_: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.in_the_money_prob_from_delta
jetblack_options.european.generalised_black_scholes.in_the_money_prob_from_delta(
is_call: bool,
T: float,
r: float,
b: float,
v: float,
delta_: float
) -> float
Parameters
is_call: bool
T: float
r: float
b: float
v: float
delta_: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.in_the_money_probability
jetblack_options.european.generalised_black_scholes.in_the_money_probability(
is_call: bool,
S: float,
K: float,
T: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.ivol
Summary
Calculate the volatility of an option that is implied by the price.
jetblack_options.european.generalised_black_scholes.ivol(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
p: float,
*,
max_iterations: int, Optional,
epsilon: float, Optional
) -> float
Parameters
is_call: bool
True for a call, false for a put.
S: float
K: float
T: float
The time to expiry of the option in years.
r: float
b: float
The cost of carry of the asset.
p: float
max_iterations: int, Optional
The maximum number of iterations before
a price is returned. Defaults to 20.
epsilon: float, Optional (optional)
The largest acceptable error. Defaults to 1e-8.
Returns
float:
The implied volatility.
function jetblack_options.european.generalised_black_scholes.make_numeric_greeks
Summary
Make a class to generate greeks numerically using finite difference methods.
jetblack_options.european.generalised_black_scholes.make_numeric_greeks(
) -> NumericGreeks
Parameters
is_call: bool
If true the options is a call; otherwise it is a put.
Returns
NumericGreeks:
A class which can generate Greeks using finite difference
methods.
function jetblack_options.european.generalised_black_scholes.max_ddelta_dvol_asset
jetblack_options.european.generalised_black_scholes.max_ddelta_dvol_asset(
is_lower: bool,
K: float,
T: float,
b: float,
v: float
) -> float
Parameters
is_lower: bool
K: float
T: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.max_ddelta_dvol_strike
jetblack_options.european.generalised_black_scholes.max_ddelta_dvol_strike(
is_lower: bool,
S: float,
T: float,
b: float,
v: float
) -> float
Parameters
is_lower: bool
S: float
T: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.max_gamma_at_S
jetblack_options.european.generalised_black_scholes.max_gamma_at_S(
x: float,
b: float,
T: float,
v: float
) -> float
Parameters
x: float
b: float
T: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.max_gamma_vega_at_X
jetblack_options.european.generalised_black_scholes.max_gamma_vega_at_X(
S: float,
b: float,
T: float,
v: float
) -> float
Parameters
S: float
b: float
T: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.max_vega_at_S
jetblack_options.european.generalised_black_scholes.max_vega_at_S(
K: float,
b: float,
T: float,
v: float
) -> float
Parameters
K: float
b: float
T: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.phi
jetblack_options.european.generalised_black_scholes.phi(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.price
Summary
The fair value of a European option, using Black-Scholes-Merton.
jetblack_options.european.generalised_black_scholes.price(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
True for a call, false for a put.
S: float
K: float
T: float
The time to expiry of the option in years.
r: float
b: float
The cost of carry of the asset.
v: float
The volatility of the asset.
Returns
float:
The price of the options.
function jetblack_options.european.generalised_black_scholes.probability_mirror_strike
jetblack_options.european.generalised_black_scholes.probability_mirror_strike(
S: float,
T: float,
b: float,
v: float
) -> float
Parameters
S: float
T: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.profit_loss_std
jetblack_options.european.generalised_black_scholes.profit_loss_std(
TypeFlag: Literal['a', 'p'],
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float,
NHedges: int
) -> float
Parameters
TypeFlag: Literal['a', 'p']
is_call: bool
S: float
K: float
T: float
r: float
b: float
v: float
NHedges: int
Returns
float:
function jetblack_options.european.generalised_black_scholes.rho
Summary
The sensitivity of the option price to the risk free rate.
Description
Useful for all options except futures options which should use
futures_rho.
jetblack_options.european.generalised_black_scholes.rho(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
True for a call, false for a put.
S: float
K: float
T: float
The time to expiry in years.
r: float
b: float
v: float
Returns
float:
The rho.
function jetblack_options.european.generalised_black_scholes.risk_neutral_density
jetblack_options.european.generalised_black_scholes.risk_neutral_density(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.rnd_from_in_the_money_prob
jetblack_options.european.generalised_black_scholes.rnd_from_in_the_money_prob(
K: float,
T: float,
r: float,
v: float,
in_the_money_prob: float
) -> float
Parameters
K: float
T: float
r: float
v: float
in_the_money_prob: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.saddle_gamma
jetblack_options.european.generalised_black_scholes.saddle_gamma(
K: float,
r: float,
b: float,
v: float
) -> float
Parameters
K: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.strike_delta
jetblack_options.european.generalised_black_scholes.strike_delta(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.strike_from_delta
jetblack_options.european.generalised_black_scholes.strike_from_delta(
is_call: bool,
S: float,
T: float,
r: float,
b: float,
v: float,
delta_: float
) -> float
Parameters
is_call: bool
S: float
T: float
r: float
b: float
v: float
delta_: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.strike_from_in_the_money_prob
jetblack_options.european.generalised_black_scholes.strike_from_in_the_money_prob(
is_call: bool,
S: float,
v: float,
T: float,
b: float,
in_the_money_prob: float
) -> float
Parameters
is_call: bool
S: float
v: float
T: float
b: float
in_the_money_prob: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.theta
Summary
The theta or time decay of the value of the option.
Description
This value is typically reported by dividing by 365 (for a one calendar day
movement) or 252 (for a 1 trading day movement).
jetblack_options.european.generalised_black_scholes.theta(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
True for a call, false for a put.
S: float
K: float
T: float
The time to expiry in years.
r: float
b: float
v: float
Returns
float:
The theta.
function jetblack_options.european.generalised_black_scholes.theta_driftless
jetblack_options.european.generalised_black_scholes.theta_driftless(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.vanna
Summary
The second order derivative of the option price to a change in the asset
Description
price and a change in the volatility.
Also known as DdeltaDvol.
jetblack_options.european.generalised_black_scholes.vanna(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
The time to expiry in years.
r: float
b: float
v: float
Returns
float:
The vanna.
function jetblack_options.european.generalised_black_scholes.variance_delta
jetblack_options.european.generalised_black_scholes.variance_delta(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.variance_ultima
jetblack_options.european.generalised_black_scholes.variance_ultima(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.variance_vega
jetblack_options.european.generalised_black_scholes.variance_vega(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.variance_vomma
jetblack_options.european.generalised_black_scholes.variance_vomma(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.vega
Summary
The sensitivity of the options price or a change in the asset volatility.
Description
This value is typically reported by dividing by 100 (for a 1% change in
volatility)
jetblack_options.european.generalised_black_scholes.vega(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
The time to expiry of the option in years.
r: float
b: float
The cost of carry of the asset.
v: float
The volatility of the asset.
Returns
float:
The vega
function jetblack_options.european.generalised_black_scholes.vega_from_delta
jetblack_options.european.generalised_black_scholes.vega_from_delta(
S: float,
T: float,
r: float,
b: float,
delta_: float
) -> float
Parameters
S: float
T: float
r: float
b: float
delta_: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.vega_leverage
jetblack_options.european.generalised_black_scholes.vega_leverage(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.vegap
jetblack_options.european.generalised_black_scholes.vegap(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.vegap_from_delta
jetblack_options.european.generalised_black_scholes.vegap_from_delta(
S: float,
T: float,
r: float,
b: float,
v: float,
delta_: float
) -> float
Parameters
S: float
T: float
r: float
b: float
v: float
delta_: float
Returns
float:
function jetblack_options.european.generalised_black_scholes.vomma
jetblack_options.european.generalised_black_scholes.vomma(
S: float,
K: float,
T: float,
r: float,
b: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
b: float
v: float
Returns
float: