Inspiration

Wall Street is chaos dressed in a suit. Irrational herds, golden moments buried in noise, fortunes made and lost in milliseconds. We wanted to feel that, not just chart it. Willy Wonka's chocolate factory became the perfect metaphor: candy storefronts as companies, golden tickets as rare trade signals, Oompa Loompas as the frantic agents chasing alpha. The question was: what if you could walk through a living, breathing stock market city where 10,000 AI traders are racing between 500 candy stores in real time?

What It Does

Wolf of Wall Sweet is a candy-themed AI agent stock market simulation. 500 real S&P-listed companies are rendered as 3D candy storefronts in a browser-based Three.js city — each store sized by its ML-computed golden score, colored by real brand identity, and placed via Poisson disk sampling. 10,000+ autonomous Oompa Loompa agents race between stores, queue at doors, fight for entry, and execute BUY / SHORT / CALL / PUT trades across four dedicated trade lanes inside each store.


How we built it

Data Pipeline — Databricks Medallion Architecture:

Bronze - Raw ingestion from Yahoo Finance (Kaggle, 602K rows, 491 tickers), FRED macro data, news, and Reddit into Delta Lake Silver - PySpark window functions compute 50+ engineered features: SMA, EMA, RSI, MACD, Bollinger Bands, Z-score, realized volatility, drawdown, forward returns (5d/20d), FinBERT news sentiment, BERTopic topic modeling, HMM market regime (Bull/Bear/Neutral), GNN correlation network edges Gold - Golden Ticket scoring across 5 tiers, rarity percentile ranking, Platinum detection, store dimensions (width/height/depth/glow based on market cap), agent density and speed multipliers Export - frontend_payload.json served from Vercel CDN with 60s cache, falls back to static JSON Backend: FastAPI + WebSockets handles live agent streaming, news analysis, regime queries, correlation network edges, and simulation result persistence. Deployed as Vercel serverless functions — no always-on compute needed.

Frontend: React 19 + TypeScript + Vite 7. Three.js via @react-three/fiber. Global state in Zustand 5. Framer Motion for UI panels.

3D Rendering: 500 stores placed via Poisson disk sampling across the city grid. 10,000 agents rendered as Oompa Loompas using 10 InstancedMesh draw calls (one per body part: overalls, shirt, head, hair, legs, arms, shoes) — 10 draw calls instead of 100,000+. Per-frame matrix updates via setMatrixAt(). A spatial hash grid (4-unit cell size) enables O(n) neighbor queries for collision detection.

AI: Google Gemini 2.0 Flash orchestrated in a multi-agent hierarchy with strict JSON output schemas. 11 sector analysts each analyze their sector's stocks and emit top 3 picks with conviction scores → portfolio manager builds a diversified 6–10 position allocation (weights sum to ~1.0, max 30% per sector) → risk desk applies position-size caps, flags dangerous shorts, and may override allocations. SphinxAI handles pipeline monitoring and observability.

ML Models: FinBERT (news sentiment), LightGBM (trade direction classifier), BERTopic (news topic modeling).

Challenges we ran into

  • Rendering 10,000 agents at 60fps
  • Gemini multi-agent coordination
  • Integrating with Databricks CLI

Accomplishments that we're proud of

10,000+ agents in-browser with smooth performance via 10 draw calls and spatial hashing

A Future Predictions feature that maps any real-world news input to affected tickers and actionable trade suggestions purely client-side via Gemini

What we learned

Instanced rendering and spatial hashing are non-negotiable for browser-scale simulations — the difference between 3fps and 60fps Delta Lake Time Travel is a genuinely powerful audit tool, not just a marketing feature — it made lookahead bias validation tractable Multi-agent LLM systems need rigid output schemas enforced at every node; freeform JSON anywhere in the chain causes cascading failures FinBERT + HMM regime detection together give substantially richer market context than either alone — sentiment without regime is noisy, regime without sentiment misses catalyst events

What's next for Wolf of Wall Sweet

Live market data — replace historical playback with real-time feeds (Polygon.io / Alpaca) so the city reflects today's actual market in real time User-controlled funds — let visitors deploy their own hedge fund with a custom strategy and compete on the leaderboard Expanded ML tiers — earnings surprise detection, options flow signals, and macro event triggers (FRED data already ingested) as additional golden ticket types

Built With

Share this project:

Updates