Trader Wars
Four trading strategies — Momentum, Contrarian, Mean-Rev, Random — fight a procedural market with live news flashes.
What this is
A 5-minute trading round on a procedurally generated stock. Four bots compete: Momentum surfs trends, Contrarian buys panic and sells euphoria, Mean-Reversion picks up oversold names, Random twitches. News headlines flash over the candle chart and gap prices instantly. Below it, a stacked-area equity chart writes the story of the round. The leaderboard re-sorts in real time with 🥇🥈🥉. When the timer ends, an endcard crowns the winner — and the next round begins.
Why this is mind-blowing
The personalities are visible. You can see the Contrarian's area band swell during a scandal. You can see Momentum get caught at the top of a rip and crash. The leaderboard flips every 10 seconds. Any of the four can win on a given seed. It's a perfect Twitch loop: a clear scoreboard, clip-able news headlines ("MERGER ANNOUNCED"), and a fresh round every 5 minutes with zero operator touch.
Build a single-file HTML page that runs four trading strategies — Momentum,
Contrarian, Mean-Reversion, Random — against the same procedural market.
GBM random walk with Gaussian noise and occasional news headlines that jolt
prices. Each strategy has a personality. A live stacked-area equity chart
records the round, a leaderboard reorders in real time with medals. After
5 minutes, an endcard crowns the winner and a fresh market spawns. No user
input — autoplay forever.
Paste this into Claude, Cursor, or Copilot. Change one thing that matters to you.
What I learned shipping it
- Apply news jolts between old/close capture so the candle visibly gaps — that's what sells the headline as a market event.
- Sampling net worth every 4 ticks for the stacked area chart is enough resolution for narrative and 4× cheaper than per-tick.
- Flex `order` on leaderboard cards is the cheapest way to get a smooth live ranking with no DOM thrash.