cox_ross_rubinstein
module jetblack_options.trees.cox_ross_rubinstein
Summary
Option valuation implementations using the Cox, Ross & Rubinstein
Description
binomial tree.
function jetblack_options.trees.cox_ross_rubinstein.greeks
Summary
A Cox-Ross-Rubinstein binomial tree option pricer returning the price and some greeks.
Parameters
is_european: boolTrue for European, false for American.
True for a call, false for a put.
The current asset price.
The option strike price
The time to maturity of the option in years.
The risk free rate.
The cost of carry of the asset.
The volatility of the asset.
The number of the steps in the tree.
Returns
Tuple[float, float, float, float]: The price, delta, gamma, theta.function jetblack_options.trees.cox_ross_rubinstein.ivol
Summary
Calculate the volatility of an option that is implied by the price.
Parameters
is_european: boolTrue for European, false for American.
True for a call, false for a put.
The current asset price.
The option strike price
The time to expiry of the option in years.
The risk free rate.
The cost of carry of the asset.
The option price.
The number of the steps in the tree.
The maximum number of iterations before a price is returned. Defaults to 20.
The largest acceptable error. Defaults to 1e-8.
Returns
float: The implied volatility.function jetblack_options.trees.cox_ross_rubinstein.make_numeric_greeks
Summary
Make a class to generate greeks numerically using finite difference methods.
Parameters
is_european: boolTrue for European, false for American.
True for a call, false for a put.
The number of the steps in the tree.
Returns
NumericGreeks: A class which can generate Greeks using finite difference methods.function jetblack_options.trees.cox_ross_rubinstein.price
Summary
Calculate the price of an option using a Cox, Ross & Rubenstein binomial tree.
Parameters
is_european: boolTrue for European, false for American.
True for a call, false for a put.
The current asset price.
The option strike price
The time to maturity of the option in years.
The risk free rate.
The cost of carry of the asset.
The volatility of the asset.
The number of the steps in the tree.