Pick any stock. Get dropped into a random moment in its history. Trade through it without knowing what's coming.
StockReplay is a historical trading simulator that tests your instincts against real market data. You get a random window from a stock's past — no dates, no headlines, just price action — and trade through it one day at a time. When the window closes, the reveal shows exactly when you were trading and how you performed against buy-and-hold.
- Search any of 67 supported tickers (AAPL, TSLA, NVDA, GME, and more)
- Choose difficulty — Beginner (12–20 weeks), Intermediate (8–14 weeks), Expert (6–10 weeks)
- Read the Market Briefing — a vague sentiment hint with no spoilers
- Trade — the chart reveals one day at a time; buy, hold, or sell
- The Reveal — find out exactly when you were trading, what you missed, and how you rank
Dates are hidden throughout. You see only price action and candlestick patterns.
- No API key required — data via yfinance (Yahoo Finance)
- 67 tickers across Technology, Finance, Healthcare, Energy, Meme stocks, and more
- Candlestick charts powered by Plotly — dark theme, zoom, pan, keyboard nav
- Featured scenarios — NVDA's AI run, GME's short squeeze, AAPL's iPhone era, and more
- Trade by shares or dollar amount — Max Buy and Sell All shortcuts
- Real-time P&L — cash, unrealized gains, total portfolio value
- Full reveal screen — buy/sell markers on the actual chart + final rating
- Local leaderboard (SQLite, no account required to play)
- Rate limiting and session hardening built in
- Sound effects via Web Audio API (toggleable)
- Mobile responsive
| Key | Action |
|---|---|
Space |
Play / Pause auto-advance |
N |
Next day |
B |
Focus buy input |
S |
Focus sell input |
Requirements: Python 3.9+
git clone https://github.com/Payshak/stockreplay.git
cd stockreplay
pip install -r requirements.txtCreate a .env file (or set env vars directly):
# Generate with: python -c "import secrets; print(secrets.token_hex(32))"
FLASK_SECRET=your-secret-key-hereThen run:
python app.pyOpen http://localhost:5000.
Set FLASK_SECRET and FLASK_HTTPS=1 in your Railway project environment, then connect the repo. The Procfile and railway.toml are already included.
Standard Flask app — runs on any Python host. Set FLASK_SECRET and optionally PORT (default 5000) and FLASK_HTTPS=1 for production.
67 tickers across 10+ sectors:
| Sector | Tickers |
|---|---|
| Technology | AAPL, MSFT, GOOGL, META, NVDA, AMD, INTC, QCOM, AVGO, TSM, ASML, CRM, ADBE, ORCL |
| E-Commerce / Consumer | AMZN, SHOP, EBAY, ETSY, COST, WMT, TGT, HD |
| Finance | JPM, BAC, GS, MS, V, MA, PYPL, SQ, BRK-B |
| Media / Streaming | NFLX, DIS, SPOT, SNAP, PINS |
| EV / Transport | TSLA, RIVN, LCID, F, GM, UBER, LYFT, ABNB |
| Healthcare | JNJ, PFE, MRNA, BNTX, UNH |
| Energy | XOM, CVX, OXY |
| Meme / Notable | GME, AMC, BB, NOK |
| Other | BABA, NIO, PLTR, COIN, RBLX, ZM, PTON, HOOD, SPY, QQQ |
stockreplay/
├── app.py # Flask routes and session logic
├── game_engine.py # Scenario selection, scoring, chart data
├── stock_data.py # Yahoo Finance fetching + 12h cache
├── requirements.txt
├── Procfile # Railway / Heroku deployment
├── railway.toml
├── static/
│ ├── style.css
│ └── ui_helpers.js
└── templates/
├── base.html
├── index.html # Search + featured scenarios
├── setup.html # Difficulty selection
├── briefing.html # Pre-simulation briefing
├── simulation.html # Trading interface
└── results.html # Reveal + leaderboard
PRs are welcome.
- New tickers: Add entries to
STOCK_METAinstock_data.py - New featured scenarios: Add entries to
FEATURED_SCENARIOSingame_engine.py - Bug reports: Open an issue with steps to reproduce and your Python version
MIT — see LICENSE