A Bloomberg-style trading terminal that runs an entire artificial financial market in your browser β 50+ securities, options, futures, ETFs, AI-driven institutional banks, a procedural news engine, and a quant-grade price model β all simulated in real time, entirely in-memory.
No server, no real money, no market data feed. Every price, every order, every headline is generated locally by the simulation engine.
You're handed a pile of capital (anywhere from $1M to $1T) and dropped into a live, breathing market. Trade equities, options, futures, and ETFs against algorithmic bots and rival AI investment banks β or go full market-maker: publish your own news, manipulate sentiment, take out loans, buy insider information (and risk getting caught), and even acquire a rival bank and run its book.
It's part trading simulator, part financial sandbox, part chaos engine.
- 50+ securities across 8 sectors (Technology, Healthcare, Energy, Financials, Consumer Discretionary, Industrials, Real Estate, Communications), each with its own price, shares outstanding, beta, dividend yield, and P/E.
- ETFs (sector and broad-market) priced from their underlying constituents.
- Futures contracts.
- Full options chain β calls & puts across multiple strikes/expiries, priced with a Black-Scholes-style model and live greeks (delta, gamma, theta, vega).
- Level-2 order book with generated bid/ask depth.
- Market, limit, and stop-loss orders.
- Short selling, margin, and leverage (selectable multipliers).
- Real-time portfolio: cash, open positions, unrealized & realized P&L, win rate, and an equity curve.
- Watchlist / favorites and a multi-tab blotter (positions, orders, news).
- Procedural news engine with 9 event categories β earnings, Fed decisions, geopolitical shocks, sector rotations, macro prints, company events, black-swan events, meme runs, and commodity moves β each with severity, sentiment, affected tickers, decay duration, and generated analyst quotes.
- Algorithmic bot traders (momentum, mean-reversion, etc.) whose collective order flow actually moves prices.
- Rival AI investment banks that trade their own multi-billion-dollar books β and which you can lend to, hedge against, or take over.
- Market halts / circuit breakers when things get violent.
- Publish your own headlines to swing sentiment and move targeted tickers.
- Buy insider information β with a real chance of getting caught.
- Issue loans to banks (with interest, accrual, and default risk).
- Three difficulty modes: Realistic (slippage + margin rules), God Mode (no restrictions), and Chaos Mode (god mode + 3Γ event frequency + 5Γ volatility).
This is the heart of the project β a genuinely quantitative price model, not random walks slapped on a chart.
Each tick, every security's return is computed from a blend of:
- Geometric Brownian Motion with jump diffusion β per-stock drift and volatility scaled by beta, plus rare large "jump" events.
- Sector correlation β an 8Γ8 correlation matrix so related sectors move together.
- Market sentiment β a global mood that decays toward neutral over time.
- Order-flow price impact β net buying/selling pressure (from you and the bots) pushes prices, normalized by each stock's liquidity/market cap and clamped to prevent runaway feedback loops.
- Mean reversion β an anchoring pull toward each security's fair value that strengthens the further price strays.
Returns are hard-clamped per tick to keep the market stable over long sessions. From the resulting moves the engine generates realistic OHLC candles and volume, and computes technical indicators on the fly: RSI, SMA, EMA, ATR, and Bollinger Bands.
The clock runs on a configurable main tick plus a 200 ms micro-tick (β5 updates/second) so prices animate smoothly between ticks. Hot market state lives in refs to avoid React re-render thrashing under that update rate.
You'll need Node.js 18+ (for npm).
# clone
git clone https://github.com/Naut1cal5/stockMarketSimulation.git
cd stockMarketSimulation
# install dependencies
npm install
# run the dev server (Vite β usually http://localhost:5173)
npm run devOpen the URL Vite prints, pick your starting capital, mode, tick speed, and number of stocks on the setup screen, and start trading.
npm run build # production build into dist/
npm run preview # preview the production build
npm run lint # run ESLintsrc/
βββ App.jsx # main orchestrator β tick loop, order routing, portfolio, bank AI
βββ main.jsx # React entry point
βββ index.css # global styles
βββ data/
β βββ stocks.js # securities universe, sectors, correlation matrix, bots & banks
βββ engine/
β βββ market.js # price model (GBM + jumps), candles, indicators,
β β # options pricing, order books, ETF pricing, bot/bank AI
β βββ news.js # procedural news & event generator
βββ components/
βββ SetupScreen.jsx # capital / mode / tick-speed / stock-count configuration
βββ TradingPanel.jsx # order entry, quote, options chain
βββ Watchlist.jsx # securities list + favorites
βββ BottomPanel.jsx # positions / orders / news / bank & god-mode controls
βββ Charts.jsx # candlestick chart, sparklines, formatters, toasts
- React 19 + Vite 8
- Tailwind CSS 4
- Recharts & D3 for charting
- Lodash utilities
- ~3,600 lines of application code; zero backend β the entire market lives in memory.
This is a simulation for entertainment and educational purposes only. Every company, ticker, price, and news event is fictional and procedurally generated. It is not financial advice, not connected to any real market or data feed, and involves no real money.
