Case Study
Quant-Link
Real-time multiplayer trading sim. A Rust/SpacetimeDB backend ticks a GBM market with volatility regimes and limit/stop orders every 2s, server-authoritative; React Three Fiber renders a walkable 3D city. 48 cargo tests.
Executive Summary
Quant-Link is a real-time multiplayer 3D trading simulation built for the SpacetimeDB Launchpad Hackathon and since hardened into a server-authoritative game. Players walk a financial metropolis, trade a Geometric Brownian Motion market that moves through volatility regimes, rest limit and stop orders, and learn from an AI quant mentor. Everything simulated is labeled simulated.
Problem & Constraints
Financial education lacks real-time multiplayer experiences that teach trading mechanics through gameplay. The constraint after the hackathon: no client-side authority over money or prices, and no simulated data presented as real.
Architecture
SpacetimeDB Rust module (scheduled GBM ticks + regime transitions + resting-order matching) ↔ real-time subscriptions ↔ React Three Fiber client + trading terminal + /methodology page + Gemini AI mentor behind a server-side proxy.
Methodology
- Rust SpacetimeDB module ticks the market every 2s; GBM math (Itô variance drag, log-return distribution) pinned by property-style tests
- Volatility regimes drive drift and vol multipliers, with regime-transition news events
- Resting limit and stop orders filled server-side on tick — no client price authority anywhere
- Reducer-level rate limits; a client speed-hack window (client-supplied dt) was found and closed
- /methodology modal documents the GBM process honestly; the ambient news ticker is labeled SIM (it is a generator, not an LLM)
- Gemini mentor calls are server-side only; the built bundle was grepped to confirm no key ships to the client
Results & Metrics
| Metric | Result |
|---|---|
| Server tests | 48 (cargo), all passing |
| Market ticks | Every 2s, GBM + regimes |
| Orders | Market + resting limit/stop |
| Authority | Fully server-side (verified in review) |
| WASM build | Clean release build |
Tech Stack
SpacetimeDB 2.4, Rust, React, React Three Fiber, TypeScript, Gemini API
Future Work
Maincloud + Vercel deployment (owner logins pending), tournament modes, order book depth.