An interactive simulator for asset price paths based on Geometric Brownian Motion (GBM), built in Python. Parameters are estimated from historical data via Yahoo Finance.
The model simulates a large number of possible future price paths for any publicly traded asset. At each time step, the price evolves according to: S(t + dt) = S(t) * exp((μ - σ²/2) * dt + σ * √dt * Z)
where Z ~ N(0,1). The term σ²/2 ensures that the simulated process has expected return exactly equal to μ, accounting for the difference between arithmetic and geometric compounding.
mu and sigma are estimated from 10 years of historical log-returns and used as default values, but can be adjusted interactively.
- Left panel: simulated price paths over the selected horizon
- Right panel: distribution of terminal prices across all scenarios
| Parameter | Description | Default |
|---|---|---|
ticker |
Yahoo Finance ticker symbol | user input |
n_years |
Simulation horizon (years) | 10 |
n_scenarios |
Number of simulated paths | 100 |
mu |
Annualized expected return | estimated from data |
sigma |
Annualized volatility | estimated from data |
equity |
Starting price | last closing price |
pip install pandas numpy matplotlib yfinance ipywidgets
Run in a Jupyter notebook or JupyterLab environment.