Inspiration
SGX FX asked us to protect traders from a market storm. In SGX's own data we found one: on 30 July 2026, USDJPY fell 290 basis points in 54 minutes. At 20x leverage that is a margin call. We wanted a tool that sounds the alarm early, shows what it means for your book, and makes it feel real. We named it Sif, after the Norse goddess whose farmers prayed to Thor for weather kind to their crops.
What it does
Sif watches one-minute FX prices and raises an alarm in the first minutes of a fast move. It replays each storm as a live 3D sea: two ships carry the same leveraged book. One follows the alarm and throws cargo overboard; the other ignores it. An Explorer lists every storm from every dataset we tested, Survive teaches beginners where the margin-call line sits, and an AI crew writes storm reports in which every number is checked by code.
How we built it
Data: SGX's one-minute FX (EURUSD, USDJPY, USDSGD), Dukascopy history for out-of-sample tests, and Yahoo minute data for chip stocks. A storm is a 15-minute move with $$|\Delta p_{15}| \ge \max\left(30\ \text{bp},\ 8,\sigma_{24h}\sqrt{15}\right)$$ Detector: simple, causal code. Its few thresholds were set on July only, then frozen for every later test. Policy simulator: fills at the next bar's bid or ask, margin checked at every open, spreads paid. Tiger Data: about 2 million minute bars in hypertables with compression (7.2x) and continuous aggregates, behind a live FastAPI. AI crew: GLM 5.3 writes reports, Qwen 3.8 Max answers what-if questions, Kimi K3.1 inspects, and a private mode runs the whole crew on gpt-oss-120b on our own Modal GPU. We chose every model by bake-off, and none of them decides when to alarm. ElevenLabs: generated the whole sound library (sea, wind, thunder, music beds and the voice alarms), mixed live from the market's risk. Web: React, three.js, cannon-es physics and Tone.js. Built in 24 hours by directing Claude Code and Codex agents in parallel lanes with strict file ownership.
Challenges we ran into
Prices gave little warning before storms, so we never predict. Instead we built a three-part defence: a calendar watch, an early alarm and a prepared book. Honest backtests are hard. Two independent code audits found look-ahead, fill-timing and margin-order problems. We fixed them all, and our flagship result shrank: following every alarm, including a false one, still left the prepared book $268,348 ahead on 30 July. GPU-only and Mac-only bugs: invalid numbers from shaders on Apple GPUs blanked the screen, and two files differing only in capital letters broke the app on macOS.
Accomplishments that we're proud of
Pre-registered, frozen out-of-sample tests on four datasets the detector never saw, with every result published, misses included. Two independent code audits with every finding fixed, and a causality check showing the detector never uses future prices, at 174 cut-offs. An AI crew whose numbers are always checked by code; in private mode on our own GPU it got every number right first time on 13 of 13 reports. A live 3D replay in which every wave, cloud and crate is driven by the data, with sound generated by ElevenLabs. Over 30 reviewed pull requests and over 400 automated tests, in 24 hours.
What we learned
Detection and response are different problems. The alarm is reliable: it fired on 83–100% of storms across four tests on unseen data. On crisis events and SGX's August it was early far more often than random timing (p = 0.0001 and 0.0006). On ordinary months of 2025 it wasn't (p = 0.37), and our blunt 75% cut lost money there. Pre-registering tests before downloading the data kept us honest.
What's next for Sif
A smarter response than a blunt 75% cut: partial hedges and confirmation rules, tested the same frozen way. Separate tuning for single stocks, where storms often arrive as gaps at the close. Live feeds with alerts to a trader's phone or desk, plus a verified release calendar for more years. Survive as a classroom tool for new traders.
Built With
- cannon-es
- claude-code
- dukascopy
- elevenlabs
- fastapi
- fireworks-ai
- gpt-oss
- lightweight-charts
- meta-ai
- modal
- numpy
- openai-codex
- pandas
- playwright
- postgresql
- python
- react
- react-three-fiber
- three.js
- tiger-data
- timescaledb
- tone.js
- typescript
- vite