module jetblack_options.european.black_scholes_merton
Summary
Black-Scholes-Merton options pricing formulae using dividend yield.
Description
- Stock price ,
- Strike price ,
- Risk-free rate ,
- Annual dividend yield ,
- Time to maturity
- Volatility .
where:
function jetblack_options.european.black_scholes_merton.break_even_probability
jetblack_options.european.black_scholes_merton.break_even_probability(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.carry
Summary
Sensitivity to the cost of carry.
jetblack_options.european.black_scholes_merton.carry(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: 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
q: float
v: float
Returns
float:
The carry.
function jetblack_options.european.black_scholes_merton.charm
jetblack_options.european.black_scholes_merton.charm(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.ddelta_dvol_dvol
jetblack_options.european.black_scholes_merton.ddelta_dvol_dvol(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.delta
Summary
The sensitivity of the open to a change in the asset price.
Description
Call
Put
jetblack_options.european.black_scholes_merton.delta(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: 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 maturity of the option in years.
r: float
q: float
v: float
The volatility of the asset.
Returns
float:
the delta.
function jetblack_options.european.black_scholes_merton.delta_from_in_the_money_prob
jetblack_options.european.black_scholes_merton.delta_from_in_the_money_prob(
is_call: bool,
T: float,
r: float,
q: float,
v: float,
in_the_money_prob: float
) -> float
Parameters
is_call: bool
T: float
r: float
q: float
v: float
in_the_money_prob: float
Returns
float:
function jetblack_options.european.black_scholes_merton.delta_mirror_call_put_strike
jetblack_options.european.black_scholes_merton.delta_mirror_call_put_strike(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.delta_mirror_strike
jetblack_options.european.black_scholes_merton.delta_mirror_strike(
S: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.dgamma_dspot
jetblack_options.european.black_scholes_merton.dgamma_dspot(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.dgamma_dtime
jetblack_options.european.black_scholes_merton.dgamma_dtime(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.dgamma_dvol
jetblack_options.european.black_scholes_merton.dgamma_dvol(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.dgammap_dspot
jetblack_options.european.black_scholes_merton.dgammap_dspot(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.dgammap_dtime
jetblack_options.european.black_scholes_merton.dgammap_dtime(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.dgammap_dvol
jetblack_options.european.black_scholes_merton.dgammap_dvol(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.dvega_dtime
jetblack_options.european.black_scholes_merton.dvega_dtime(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.dvegap_dvol
jetblack_options.european.black_scholes_merton.dvegap_dvol(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.dvomma_dvol
jetblack_options.european.black_scholes_merton.dvomma_dvol(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.dzeta_dtime
jetblack_options.european.black_scholes_merton.dzeta_dtime(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.dzeta_dvol
jetblack_options.european.black_scholes_merton.dzeta_dvol(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.elasticity
Summary
jetblack_options.european.black_scholes_merton.elasticity(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: 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
q: float
v: float
Returns
float:
The elasticity.
function jetblack_options.european.black_scholes_merton.forward_delta
jetblack_options.european.black_scholes_merton.forward_delta(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.futures_rho
jetblack_options.european.black_scholes_merton.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.black_scholes_merton.gamma
Summary
The second derivative to the change in the asset price.
Description
Γ$$e−qτφ(d1)Sστ=Ke−rτφ(d2)S2στ
jetblack_options.european.black_scholes_merton.gamma(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
The time to maturity of the option in years.
r: float
q: float
v: float
The volatility of the asset.
Returns
float:
The gamma.
function jetblack_options.european.black_scholes_merton.gamma_from_delta
jetblack_options.european.black_scholes_merton.gamma_from_delta(
S: float,
T: float,
q: float,
v: float,
delta_: float
) -> float
Parameters
S: float
T: float
q: float
v: float
delta_: float
Returns
float:
function jetblack_options.european.black_scholes_merton.gammap
jetblack_options.european.black_scholes_merton.gammap(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.gammap_from_delta
jetblack_options.european.black_scholes_merton.gammap_from_delta(
S: float,
T: float,
q: float,
v: float,
delta_: float
) -> float
Parameters
S: float
T: float
q: float
v: float
delta_: float
Returns
float:
function jetblack_options.european.black_scholes_merton.in_the_money_prob_from_delta
jetblack_options.european.black_scholes_merton.in_the_money_prob_from_delta(
is_call: bool,
T: float,
r: float,
q: float,
v: float,
delta_: float
) -> float
Parameters
is_call: bool
T: float
r: float
q: float
v: float
delta_: float
Returns
float:
function jetblack_options.european.black_scholes_merton.in_the_money_probability
jetblack_options.european.black_scholes_merton.in_the_money_probability(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.ivol
Summary
Calculate the volatility of an option that is implied by the price.
jetblack_options.european.black_scholes_merton.ivol(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: 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 maturity of the option in years.
r: float
q: float
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.black_scholes_merton.make_numeric_greeks
Summary
Make a class to generate greeks numerically using finite difference methods.
jetblack_options.european.black_scholes_merton.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.black_scholes_merton.max_ddelta_dvol_asset
jetblack_options.european.black_scholes_merton.max_ddelta_dvol_asset(
is_lower: bool,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
is_lower: bool
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.max_ddelta_dvol_strike
jetblack_options.european.black_scholes_merton.max_ddelta_dvol_strike(
is_lower: bool,
S: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
is_lower: bool
S: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.max_gamma_at_S
jetblack_options.european.black_scholes_merton.max_gamma_at_S(
x: float,
r: float,
q: float,
T: float,
v: float
) -> float
Parameters
x: float
r: float
q: float
T: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.max_gamma_vega_at_X
jetblack_options.european.black_scholes_merton.max_gamma_vega_at_X(
S: float,
r: float,
q: float,
T: float,
v: float
) -> float
Parameters
S: float
r: float
q: float
T: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.max_vega_at_S
jetblack_options.european.black_scholes_merton.max_vega_at_S(
K: float,
r: float,
q: float,
T: float,
v: float
) -> float
Parameters
K: float
r: float
q: float
T: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.phi
jetblack_options.european.black_scholes_merton.phi(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.price
Summary
The fair value of a European option, using Black-Scholes-Merton.
Description
Call price:
Put price:
jetblack_options.european.black_scholes_merton.price(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: 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 maturity of the option in years.
r: float
q: float
v: float
The volatility of the asset.
Returns
float:
The price of the options.
function jetblack_options.european.black_scholes_merton.probability_mirror_strike
jetblack_options.european.black_scholes_merton.probability_mirror_strike(
S: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.profit_loss_std
jetblack_options.european.black_scholes_merton.profit_loss_std(
TypeFlag: Literal['a', 'p'],
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: float,
v: float,
NHedges: int
) -> float
Parameters
TypeFlag: Literal['a', 'p']
is_call: bool
S: float
K: float
T: float
r: float
q: float
v: float
NHedges: int
Returns
float:
function jetblack_options.european.black_scholes_merton.rho
Summary
The sensitivity of the option price to the risk free rate.
Description
Call is
Put is
Useful for all options except futures options which should use
futures_rho.
jetblack_options.european.black_scholes_merton.rho(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: 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
q: float
v: float
Returns
float:
The rho.
function jetblack_options.european.black_scholes_merton.risk_neutral_density
jetblack_options.european.black_scholes_merton.risk_neutral_density(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.rnd_from_in_the_money_prob
jetblack_options.european.black_scholes_merton.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.black_scholes_merton.saddle_gamma
jetblack_options.european.black_scholes_merton.saddle_gamma(
K: float,
q: float,
v: float
) -> float
Parameters
K: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.strike_delta
jetblack_options.european.black_scholes_merton.strike_delta(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.strike_from_delta
jetblack_options.european.black_scholes_merton.strike_from_delta(
is_call: bool,
S: float,
T: float,
r: float,
q: float,
v: float,
delta_: float
) -> float
Parameters
is_call: bool
S: float
T: float
r: float
q: float
v: float
delta_: float
Returns
float:
function jetblack_options.european.black_scholes_merton.strike_from_in_the_money_prob
jetblack_options.european.black_scholes_merton.strike_from_in_the_money_prob(
is_call: bool,
S: float,
v: float,
T: float,
r: float,
q: float,
in_the_money_prob: float
) -> float
Parameters
is_call: bool
S: float
v: float
T: float
r: float
q: float
in_the_money_prob: float
Returns
float:
function jetblack_options.european.black_scholes_merton.theta
Summary
The theta or time decay of the value of the option.
Description
CallΘ$$−e−qτSφ(d1)σ2τ−rKe−rτΦ(d2)+qSe−qτΦ(d1)
jetblack_options.european.black_scholes_merton.theta(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: 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
q: float
v: float
Returns
float:
The theta.
function jetblack_options.european.black_scholes_merton.theta_driftless
jetblack_options.european.black_scholes_merton.theta_driftless(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.vanna
Summary
The sensitivity to the spot price and volatility.
Description
−e−qτφ(d1)d2σ=𝒱S[1−d1στ]
jetblack_options.european.black_scholes_merton.vanna(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
The time to expiry in years.
r: float
q: float
v: float
Returns
float:
The vanna.
function jetblack_options.european.black_scholes_merton.variance_delta
jetblack_options.european.black_scholes_merton.variance_delta(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.variance_ultima
jetblack_options.european.black_scholes_merton.variance_ultima(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.variance_vega
jetblack_options.european.black_scholes_merton.variance_vega(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.variance_vomma
jetblack_options.european.black_scholes_merton.variance_vomma(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.vega
Summary
The sensitivity of the options price or a change in the asset volatility.
Description
𝒱$is$Se−qτφ(d1)τ=Ke−rτφ(d2)τ
jetblack_options.european.black_scholes_merton.vega(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
The time to maturity of the option in years.
r: float
q: float
v: float
The volatility of the asset.
Returns
float:
The vega
function jetblack_options.european.black_scholes_merton.vega_from_delta
jetblack_options.european.black_scholes_merton.vega_from_delta(
S: float,
T: float,
q: float,
delta_: float
) -> float
Parameters
S: float
T: float
q: float
delta_: float
Returns
float:
function jetblack_options.european.black_scholes_merton.vega_leverage
jetblack_options.european.black_scholes_merton.vega_leverage(
is_call: bool,
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
is_call: bool
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.vegap
jetblack_options.european.black_scholes_merton.vegap(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float:
function jetblack_options.european.black_scholes_merton.vegap_from_delta
jetblack_options.european.black_scholes_merton.vegap_from_delta(
S: float,
T: float,
q: float,
v: float,
delta_: float
) -> float
Parameters
S: float
T: float
q: float
v: float
delta_: float
Returns
float:
function jetblack_options.european.black_scholes_merton.vomma
jetblack_options.european.black_scholes_merton.vomma(
S: float,
K: float,
T: float,
r: float,
q: float,
v: float
) -> float
Parameters
S: float
K: float
T: float
r: float
q: float
v: float
Returns
float: