trinomial
module jetblack_options.trees.trinomial
Summary
Option valuations using a trinomial tree.
function jetblack_options.trees.trinomial.greeks
Summary
A trinomial tree options 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.trinomial.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.trinomial.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.trinomial.price
Summary
Calculate the price of an option using a trinomial 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.