Stock Market Simulator NEW

Explore financial markets through three simulation modes: single-stock geometric Brownian motion price paths, a five-asset correlated portfolio, and the Minsky boom-bust cycle. Test six different trading strategies and observe how randomness, volatility, and time horizon affect wealth accumulation.

📈 Geometric Brownian Motion

Stock prices evolve according to GBM � the foundation of the Black�Scholes options pricing model. The stochastic differential equation and its exact solution:

dS = �S dt + sS dW
S(t) = S0 � exp((� - s�/2)t + svt � Z)
Z ~ N(0,1)

Where � is the drift (annual expected return), s is annual volatility, and dW is a Wiener process increment.

📊 Log-Normal Prices

Because returns are normally distributed, prices are log-normally distributed. This means prices can never go negative and the distribution is right-skewed � matching observed equity price distributions.

ln(S_T/S_0) ~ N((�-s�/2)T, s�T)
E[S_T] = S_0 � exp(�T)
Var[S_T] = S_0� e^(2�T)(e^(s�T)-1)

🔗 Correlated Assets

The portfolio mode uses Cholesky decomposition to generate correlated Brownian motions for five asset classes. Given correlation matrix S, the decomposition L satisfying LL ? = S transforms independent standard normals into correlated price shocks.

Z_corr = L � Z_indep
L = cholesky(S)
Cov(Tech, Finance) = 0.45

📉 Minsky Cycle

Hyman Minsky's financial instability hypothesis: prosperity breeds risk-taking, which breeds fragility. The crash mode simulates five phases with time-varying � and s parameters.

Boom: �=+0.30, s=0.12 (60 days)
Euphoria: �=+0.50, s=0.08 (30 days)
Panic: �=-0.80, s=0.50 (20 days)
Crash: �=-0.40, s=0.35 (40 days)
Recovery: �=+0.20, s=0.22 (100 days)

Trading Strategy Comparison

StrategyLogicTypical frequencyKey riskLong-run evidence
Buy & HoldInvest at t=0, never sellOnceFull market exposureBeats 80%+ active funds over 20 y
Day TradingBuy on +0.5% daily momentum, sell on -0.5%DailyRandom noise triggers, costs~70% of day traders lose money
Value InvestingBuy when price < 90% of 50-day MAWeeklyValue traps, patience requiredHistorically +2�4% alpha annually
Index FundsMonthly rebalance to 70/30 stock/bondMonthlyBroad market downturnsAverage 10%/yr nominal S&P 500
Momentum20-day vs 60-day MA crossoverWeeklyWhipsawing in choppy marketsWorks in trending markets
AlgorithmicGBM + Minsky crash parametersContinuousModel risk, tail eventsVaries widely by implementation

Risk Metrics Explained

MetricFormulaInterpretation
Total Return(V_T - V_0) / V_0 � 100%Overall profit/loss as percentage of initial capital
Max Drawdownmax[(peak - trough) / peak]Largest peak-to-trough decline. Measures worst-case loss
Sharpe Ratio(R_p - R_f) / s_pRisk-adjusted return. >1 is good, >2 is excellent
Volatility sstd(daily log returns) � v252Annualised standard deviation. S&P 500 � 16%/yr
Value at Risk (VaR)-s � 1.645 � vT � V95% confidence max loss over horizon T (normal dist.)

Fundamental Diagram: Return vs Volatility

Asset ClassExpected Return �Volatility sSharpe (approx)Correl to Tech
Tech Equity18%32%0.441.00
Financial Equity10%20%0.400.45
Energy Equity8%28%0.250.30
Healthcare Equity12%18%0.560.20
Government Bonds4%6%0.33-0.15

Curriculum Connections

SubjectLevelTopic
MathematicsA-Level / APStochastic processes, normal distribution, exponential functions
StatisticsUndergraduateLog-normal distribution, Cholesky decomposition, Monte Carlo methods
FinanceUndergraduateBlack-Scholes model, portfolio theory, Markowitz efficient frontier
EconomicsA-Level / APFinancial markets, investment, risk vs return, EMH
Computer ScienceA-Level / APRandom number generation, simulation algorithms, data visualisation

Frequently Asked Questions

What is Geometric Brownian Motion?

GBM is a continuous-time stochastic process where log returns are normally distributed and independent. It is the standard model for equity prices in the Black�Scholes framework, capturing the observed lognormal distribution of stock prices and the unpredictability of short-term returns.

Why do stock prices follow a random walk?

According to the Efficient Market Hypothesis, all available information is already priced in. Only new, random information moves prices, making future price changes unpredictable from past data � the weak form of market efficiency. This simulator shows both the randomness and how strategy time horizons interact with it.

What is the Minsky cycle?

Hyman Minsky's financial instability hypothesis observes that long periods of stability breed complacency and leverage, inevitably leading to a "Minsky moment" � a sudden collapse. The simulator runs Boom ? Euphoria ? Panic ? Crash ? Recovery, each with historically calibrated � and s values.

Which trading strategy performs best?

Over long horizons (20�30 years), Buy & Hold and Index Funds consistently outperform active strategies due to compounding and lower transaction costs. Day Trading and Momentum strategies may show large variance but rarely beat passive strategies after risk adjustment � a result deeply confirmed in empirical finance literature.

Related Simulations