Skip to content

leisen_reimer

module jetblack_options.trees.leisen_reimer

Summary

Option valuations using the Leisen Reimer method.

function jetblack_options.trees.leisen_reimer.greeks

Summary

Calculate the price and some greeks using a Leisen-Reimer binomial tree.

jetblack_options.trees.leisen_reimer.greeks(
is_european: bool,
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float,
n: int
) -> Tuple[float, float, float, float]

Parameters

is_european: bool

Tue for European, false for American.

is_call: bool

True for a call, false for a put.

S: 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.

b: float

The cost of carry of the asset.

v: float

The volatility of the asset.

n: int

The number of the steps in the tree.

Returns

Tuple[float, float, float, float]: The price, delta, gamma, theta.

function jetblack_options.trees.leisen_reimer.ivol

Summary

Calculate the volatility of an option that is implied by the price.

jetblack_options.trees.leisen_reimer.ivol(
is_european: bool,
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
p: float,
n: int,
*,
max_iterations: int, Optional,
epsilon: float, Optional
) -> float

Parameters

is_european: bool

True for European, false for American.

is_call: bool

True for a call, false for a put.

S: float

The current asset price.

K: float

The option strike price

T: float

The time to expiry of the option in years.

r: float

The risk free rate.

b: float

The cost of carry of the asset.

p: float

The option price.

n: int

The number of the steps in the tree.

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.trees.leisen_reimer.make_numeric_greeks

Summary

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

jetblack_options.trees.leisen_reimer.make_numeric_greeks(
is_european: bool,
is_call: bool,
n: int
) -> NumericGreeks

Parameters

is_european: bool

True for European, false for American.

is_call: bool

True for a call, false for a put.

n: int

The number of the steps in the tree.

Returns

NumericGreeks: A class which can generate Greeks using finite difference methods.

function jetblack_options.trees.leisen_reimer.price

Summary

Calculate the price using a Leisen-Reimer binomial tree.

jetblack_options.trees.leisen_reimer.price(
is_european: bool,
is_call: bool,
S: float,
K: float,
T: float,
r: float,
b: float,
v: float,
n: int
) -> float

Parameters

is_european: bool

Tue for European, false for American.

is_call: bool

True for a call, false for a put.

S: 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.

b: float

The cost of carry of the asset.

v: float

The volatility of the asset.

n: int

The number of the steps in the tree.

Returns

float: The price.