Calculate the Binomial Option Pricing Model, a mathematical model used to estimate the price of European and American style options. It does so by creating a binomial tree of price paths for the underlying asset, and then working backwards through the tree to determine the price of the option at each node.

By default the most recent risk free rate, dividend yield and stock price is used, you can alter this by changing the start date. The volatility is calculated based on the daily returns of the stock price and the selected period (this can be altered by defining this accordingly when defining the Toolkit class, start_date and end_date).

The formulas are as follows:

\[\text{up movement} (u) = e ^{\sigma \cdot \sqrt{t}}\] \[\text{down movement} (d) = 1 / u\] \[\text{risk neutral probability} (p) = (e ^{(r - q) \cdot t} - d) / (u - d)\] \[\text{stock price at each node} = S \cdot u ^{j} \cdot d ^{n - j}\] \[\text{call option price at expiration date} = \max(S - K,\; 0)\] \[\text{put option price at expiration date} = \max(K - S,\; 0)\]

For European Style options:

\[\text{call option price at each node} = (p \cdot C_{u} + (1 - p) \cdot C_{d}) \cdot e ^{- r \cdot t}\] \[\text{put option price at each node} = (p \cdot P_{u} + (1 - p) \cdot P_{d}) \cdot e ^{- r \cdot t}\]

For American Style options:

\[\text{call option price at each node} = \max(S - K,\; (p \cdot C_{u} + (1 - p) \cdot C_{d}) \cdot e ^{- r \cdot t})\] \[\text{put option price at each node} = \max(K - S,\; (p \cdot P_{u} + (1 - p) \cdot P_{d}) \cdot e ^{- r \cdot t})\]

Where S is the stock price, K is the strike price, r is the risk free rate, σ is the volatility, t is the time to expiration, j is the number of up movements, n is the number of time steps, C_u is the call option price at the up movement, C_d is the call option price at the down movement, P_u is the put option price at the up movement and P_d is the put option price at the down movement.

The resulting output is a DataFrame containing the tickers, strike prices and movements as the index and the time to expiration as the columns. The movements index contains the number of up movements and the number of down movements. The output is the binomial tree displayed in a table. E.g. when using 10 time steps, the table for each strike price from each company will contain the actual binomial tree as also depicted in the image found here: https://en.wikipedia.org/wiki/Binomial_options_pricing_model#Method

Also known as: binomial tree, lattice model, option pricing.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Binomial Model for you. Just ask in plain English.

Calculate the Binomial Model in Python

The Binomial Model is available in the Options module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_binomial_model as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AAPL", "MSFT"], api_key="FINANCIAL_MODELING_PREP_KEY")

binomial_trees_model = toolkit.options.get_binomial_trees_model(
    start_date='2024-02-02'
)

binomial_trees_model.loc['AAPL', 140]

Which returns:

Movement 2024-02-02 2024-03-09 2024-04-15 2024-05-21 2024-06-27 2024-08-02 2024-09-08 2024-10-14 2024-11-20 2024-12-26 2025-02-01
UUUUUUUUUU 53.9518 69.0761 86.6159 106.476 128.56 152.858 179.496 208.695 240.695 275.76 314.18
UUUUUUUUUD nan 39.3262 52.173 67.5522 85.3691 105.438 127.617 151.936 178.598 207.823 239.852
UUUUUUUUDD nan nan 26.8446 37.2767 50.3585 66.0853 84.2272 104.466 126.663 151.003 177.689
UUUUUUUDDD nan nan nan 16.6633 24.5421 35.0986 48.5539 64.764 83.2271 103.482 125.698
UUUUUUDDDD nan nan nan nan 8.9417 14.216 21.9711 32.795 46.8998 63.7382 82.2161
UUUUUDDDDD nan nan nan nan nan 3.7526 6.596 11.3548 18.9981 30.4984 45.85
UUUUDDDDDD nan nan nan nan nan nan 0.9457 1.9009 3.8207 7.6794 15.4353
UUUDDDDDDD nan nan nan nan nan nan nan 0 0 0 0
UUDDDDDDDD nan nan nan nan nan nan nan nan 0 0 0
UDDDDDDDDD nan nan nan nan nan nan nan nan nan 0 0
DDDDDDDDDD nan nan nan nan nan nan nan nan nan nan 0

Parameters

get_binomial_model accepts the following parameters:

  • start_date (str | None, optional): The start date which determines the stock price. Defaults to None which means it will use the most recent date.
  • put_option (bool, optional): Whether to calculate the put option price. Defaults to False which means it will calculate the call option price.
  • strike_price_range (float): The percentage range to use for the strike prices. Defaults to 0.25 which equals 25% and thus results in strike prices from 75 to 125 if the current stock price is 100.
  • strike_step_size (int): The step size to use for the strike prices. Defaults to 5 which means that the strike prices will be 75, 80, 85, 90, 95, 100, 105, 110, 115 and 120 if the current stock price is 100.
  • time_to_expiration (int): The number of year to use for the time to expiration. Defaults to 1 which equals one year.
  • timesteps (int): The number of time steps to use for the binomial tree. Defaults to 10 which equals 10 time steps. This will be evenly distributed over the time to expiration.
  • risk_free_rate (float, optional): The risk free rate to use for the calculation. Defaults to None which means it will use the current risk free rate.
  • dividend_yield (float, optional): The dividend yield to use for the calculation. Defaults to None which means it will use the dividend yield as obtained through annual historical data.
  • show_input_info (bool, optional): Whether to show the input information. Defaults to False.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
  • standardize (bool, optional): Whether to standardize (Z-Score) the result across the time to expiration columns for each ticker and strike price. Defaults to False.

The Options module page introduces the module, and the sidebar lists all of its functions.

Share