Skip to content

black_76

module jetblack_options.european.black_76

Summary

Black (1976) Options on futures/forwards

Description

  • The discounted futures price F,
  • Strike price K,
  • Risk-free rate r,
  • Annual dividend yield q,
  • Time to maturity τ=T−t
  • Volatility σ.

Most of the formula use one or both of the following terms.

d1=ln(F/K)+(σ2/2)TσT d2=ln(F/K)−(σ2/2)TσT=d1−σT φ(x)&=12πe−12x2 Φ(x)&=12π∫−∞xe−12y2dy=1−12π∫x∞e−12y2dy

function jetblack_options.european.black_76.delta

Summary

The sensitivity of the option to a change in the asset price

Description

using Black 76.

For the call.

∂C∂S=e−rτΦ(d1)

For the put.

∂P∂S=−e−rτΦ(−d1)
jetblack_options.european.black_76.delta(
is_call: bool,
F: float,
K: float,
T: float,
r: float,
v: float
) -> float

Parameters

is_call: bool

True for a call, false for a put.

F: float

The current futures price.

K: float

The strike price.

T: float

The time to expiry in years.

r: float

The risk free rate.

v: float

The volatility.

Returns

float: The delta.

function jetblack_options.european.black_76.gamma

Summary

The second derivative to the change in asset price using Black 76.

Description

The gamma for both calls and puts.

∂2V∂S2=e−rτφ(d1)Fστ=Ke−rτφ(d2)F2στ
jetblack_options.european.black_76.gamma(
F: float,
K: float,
T: float,
r: float,
v: float
) -> float

Parameters

F: float

The current futures price.

K: float

The strike price.

T: float

The time to expiry in years.

r: float

The risk free rate.

v: float

The volatility.

Returns

float: The gamma.

function jetblack_options.european.black_76.ivol

Summary

Calculate the volatility of a Black 76 option that is implied by the price.

jetblack_options.european.black_76.ivol(
is_call: bool,
F: float,
K: float,
T: float,
r: float,
p: float,
*,
max_iterations: int, Optional,
epsilon: float, Optional
) -> float

Parameters

is_call: bool

True for a call, false for a put.

F: float

The current asset price.

K: float

The option strike price

T: float

The time to maturity of the option in years.

r: float

The risk free rate.

p: float

The option price.

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_76.make_numeric_greeks

Summary

Make a class to generate greeks numerically using finite difference methods.

jetblack_options.european.black_76.make_numeric_greeks(
is_call: bool
) -> 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_76.price

Summary

Fair value of a futures/forward using Black 76.

Description

For a call:

C=e−rτ[FΦ(d1)−KΦ(d2)]

For a put:

P=e−rτ[KΦ(−d2)−FΦ(−d1)]
jetblack_options.european.black_76.price(
is_call: bool,
F: float,
K: float,
T: float,
r: float,
v: float
) -> float

Parameters

is_call: bool

True for a call, false for a put.

F: float

The price of the future.

K: float

The strike price.

T: float

The time to expiry in years.

r: float

The risk free rate.

v: float

The asset volatility.

Returns

float: The option price.

function jetblack_options.european.black_76.rho

Summary

The sensitivity of the option price to a change in the risk free rate

Description

using Black 76.

For a call:

∂C∂r=−τe−rτ[FΦ(d1)−KΦ(d2)]

For a put:

∂P∂r=−τe−rτ[KΦ(−d2)−FΦ(−d1)]
jetblack_options.european.black_76.rho(
is_call: bool,
F: float,
K: float,
T: float,
r: float,
v: float
) -> float

Parameters

is_call: bool

True for a call, false for a put.

F: float

The price of the future.

K: float

The strike price.

T: float

The time to expiry in years.

r: float

The risk free rate.

v: float

The asset volatility.

Returns

float: The rho.

function jetblack_options.european.black_76.theta

Summary

The change in the value of the option with respect to time to expiry

Description

using Black 76.

For the call.

∂C∂T−Fe−rτφ(d1)σ2τ−rKe−rτΦ(d2)+rFe−rτΦ(d1)

For the put.

∂P∂T−Fe−rτφ(d1)σ2τ+rKe−rτΦ(−d2)−rFe−rτΦ(−d1)
jetblack_options.european.black_76.theta(
is_call: bool,
F: float,
K: float,
T: float,
r: float,
v: float
) -> float

Parameters

is_call: bool

True for a call, false for a put.

F: float

The current futures price.

K: float

The strike price.

T: float

The time to expiry in years.

r: float

The risk free rate.

v: float

The volatility.

Returns

float: The theta.

function jetblack_options.european.black_76.vanna

Summary

The sensitivity of the option value to the underlying

Description

asset price and the volatility.

For both calls and puts.

∂2V∂F∂σ=−e−rτφ(d1)d2σ=𝒱F[1−d1στ]
jetblack_options.european.black_76.vanna(
F: float,
K: float,
T: float,
r: float,
v: float
) -> float

Parameters

F: float

The price of the future.

K: float

The strike price.

T: float

The time to expiry in years.

r: float

The risk free rate.

v: float

The asset volatility.

Returns

float: The vanna.

function jetblack_options.european.black_76.vega

Summary

The sensitivity of the options price or a change in the asset volatility

Description

using Black 76.

For both calls and puts.

∂V∂σ=Fe−rτφ(d1)τ=Ke−rτφ(d2)τ
jetblack_options.european.black_76.vega(
F: float,
K: float,
T: float,
r: float,
v: float
) -> float

Parameters

F: float

The current futures price.

K: float

The strike price.

T: float

The time to expiry in years.

r: float

The risk free rate.

v: float

The volatility.

Returns

float: The vega.

function jetblack_options.european.black_76.vomma

Summary

The second order sensitivity to volatility.

Description

For both puts and calls.

∂2V∂σ2=Fe−rτφ(d1)τd1d2σ=𝒱d1d2σ
jetblack_options.european.black_76.vomma(
F: float,
K: float,
T: float,
r: float,
v: float
) -> float

Parameters

F: float

The price of the future.

K: float

The strike price.

T: float

The time to expiry in years.

r: float

The risk free rate.

v: float

The asset volatility.

Returns

float: The vomma