Skip to content

About

Trade through real market history — 2008 crisis, 2020 COVID crash, or a calm year. Real historical data, pure HTML/CSS/JS, GitHub Pages.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Market Simulator

An interactive market simulation game — trade a portfolio through real historical market history and see how you'd have actually done. Dark, professional finance-terminal aesthetic, matching risk-command-center and valuation-command-center.

Live demo: https://nnd1106.github.io/market-simulator/

How it works

  1. Pick a scenario — the 2008 Financial Crisis, the 2020 COVID crash & recovery, or a calm 2017 bull-market year.
  2. Pick a market — India (Nifty 50 constituents, ₹) or Global (S&P 500-era US large-caps, $) — and your starting capital (default ₹10,00,000 / $10,000, adjustable).
  3. Play — step day by day, step a week at a time, or hit Play to fast-forward automatically (1×/3×/8×) through the real historical period, buying and selling from a 15-stock list at that day's actual closing price (0.05% brokerage per trade). A headline ticker surfaces real, dated events as they happen. Your portfolio value is charted live against the benchmark, both starting from the same capital.
  4. Results — total return, return vs. benchmark, annualized Sharpe ratio (rf=0), maximum drawdown, and a rule-based "risk personality" read (Panic Seller / Buy & Hold / Aggressive-Contrarian / Active Trader / Conservative / Balanced Investor) derived from what you actually did during the scenario's worst drawdown window — did you raise cash and sell, buy the dip, trade constantly, or barely touch it.

Data: what it is, where it came from, and how it was verified

All price data is real historical daily closing prices — nothing in this game is synthetic. It's fetched once (by the developer, not at runtime) from Yahoo Finance's public chart endpoint and shipped as static JSON files in data/. The deployed game makes zero API calls — it only ever reads these local files, so there's nothing to rate-limit, no key, and no billing risk of any kind.

Why Yahoo Finance: it's free with no signup, no key, and no card. The catch is it blocks requests without a browser-like User-Agent header (returns 429/blocked otherwise) — a one-line fix once identified, and irrelevant to the shipped game anyway since the fetch happened once, offline, not from a player's browser.

Verification performed before shipping (see the fetch script's commit for the raw process): every scenario's benchmark series was checked against well-documented historical facts before being used:

Check Found in data Known historical figure
S&P 500 pre-crisis peak 1,565.15 on 2007-10-09 Widely-cited actual ATH close
S&P 500 crisis bottom 676.53 on 2009-03-09 The famous, exact, oft-cited bottom
S&P 500 2007-09 decline -56.4% Commonly cited "~57% peak-to-trough"
Nifty 50 pre-crisis peak 6,287.85 on 2008-01-08 Matches documented Jan 2008 peak
S&P 500 COVID peak 3,386.15 on 2020-02-19 Exact documented pre-COVID ATH
S&P 500 COVID bottom 2,237.40 on 2020-03-23 Exact documented COVID low
Nifty 50 COVID bottom 7,610.25 on 2020-03-23 Matches documented COVID low
2017 S&P 500 max drawdown -2.8% Matches "calmest year in decades"
2017 Nifty 50 full-year return +28.7% Matches widely-cited ~29% figure

A systematic scan also flagged every single-day move over 18% across all 32 tickers × 3 scenarios for manual review. Every one checked out against a real, dated event — e.g. Oct 13, 2008 (the Dow's best day in 70 years), May 18, 2009 (Indian markets hit their upper circuit breaker on a decisive, market-friendly election result), and Oct 25, 2017 (Indian PSU bank stocks surged on a ₹2.11 lakh crore recapitalization announcement). None turned out to be a data artifact.

One stock (TATAMOTORS.NS) returned no data from Yahoo (likely due to a 2023 corporate restructuring) and was swapped for WIPRO.NS rather than shipped with a gap.

Stack

Pure HTML/CSS/JS + Chart.js (via CDN). No frameworks, no bundler, no backend, no runtime API dependency. ~950KB of cached historical data across 97 JSON files.

About

Trade through real market history — 2008 crisis, 2020 COVID crash, or a calm year. Real historical data, pure HTML/CSS/JS, GitHub Pages.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages