Stock Price Simulation
Simulate the Stock Price based on the Binomial 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 based on the stock price, its volatility and the time to expiration: each step multiplies the price by u = e^(σ * sqrt(Δt)) or by d = 1 / u. The stock price is then simulated based on these up and down movements.
By default the most recent stock price is used, you can alter this by changing the start date. The volatility is the annualized standard deviation of the daily returns over the year before that date, so an earlier start date only uses what was known on that date.
The formulas are as follows:
\[\text{up movement} (u) = e ^{\sigma \cdot \sqrt{\Delta t}}\] \[\text{down movement} (d) = 1 / u\] \[\text{stock price at each node} = S \cdot u ^{j} \cdot d ^{n - j}\]Where S is the stock price, σ is the volatility, Δt is the length of a time step (the time to expiration divided by the number of time steps), j is the number of up movements and n is the number of time steps. The risk free rate and the dividend yield do not affect the tree.
The resulting output is a DataFrame containing the tickers 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 from each company will contain the actual binomial tree’s stock prices as also depicted in the image found here: https://en.wikipedia.org/wiki/Binomial_options_pricing_model#Method
Hint: consider plotting the resulting DataFrame for each company to visualize the binomial tree. For example for below’s example use stock_price_simulation.loc['AMD'].T.plot(legend=False)
Also known as: binomial tree, stock price tree, stock price path, lattice.
Stock Price Simulation in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_stock_price_simulation as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["AMD"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2025-01-01",
end_date="2025-12-31",
)
stock_price_simulation = toolkit.options.get_stock_price_simulation(
timesteps=5, show_unique_combinations=True
)
stock_price_simulation.loc["AMD"]
Or, after setting up the Finance Toolkit MCP, ask:
Which share prices can AMD reach in a one-year binomial tree with five steps from the close of 31 December 2025, for each unique combination of up and down moves?
Which returns:
| Movement | 2025-12-31 | 2026-03-14 | 2026-05-26 | 2026-08-07 | 2026-10-19 | 2026-12-31 |
|---|---|---|---|---|---|---|
| UUUUU | 214.16 | 280.988 | 368.67 | 483.712 | 634.654 | 832.696 |
| DUUUU | 214.16 | 163.226 | 214.16 | 280.988 | 368.67 | 483.712 |
| DDUUU | 214.16 | 163.226 | 124.405 | 163.226 | 214.16 | 280.988 |
| DDDUU | 214.16 | 163.226 | 124.405 | 94.8177 | 124.405 | 163.226 |
| DDDDU | 214.16 | 163.226 | 124.405 | 94.8177 | 72.267 | 94.8177 |
| DDDDD | 214.16 | 163.226 | 124.405 | 94.8177 | 72.267 | 55.0796 |
Parameters
get_stock_price_simulation accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
start_date | str | None | The date whose price, volatility and rates the values start from; a date without prices (a weekend or a holiday) uses the last trading day before it, and a ticker without a price on that day is left out with a warning. Defaults to None, which uses the last date of the historical data. | "2021-01-01" |
time_to_expiration | float | The number of years to use for the time to expiration. Defaults to 1 which equals one year. | 2 |
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. | 100 |
risk_free_rate | float | The risk free rate shown with show_input_info; it does not affect the simulated prices. Defaults to None, which uses the Toolkit’s risk-free rate on the pricing date: the 10-year Treasury yield unless the Toolkit’s risk_free_rate parameter selects ‘13w’, ‘5y’ or ‘30y’, converted from its semi-annual bond-equivalent quote to continuous compounding. A rate passed here is used as given, as a continuously compounded rate. | 0.04 |
show_unique_combinations | bool | Whether to show the unique combinations of the stock prices. Defaults to False. | True |
show_input_info | bool | Whether to show the input information. Defaults to False. | True |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
standardize | bool | Whether to standardize (Z-Score) the result across the time to expiration columns for each ticker and strike price. Defaults to False. | True |