07Case study
Trend Fiver
Real-time financial prediction engine
- Year
- Role
- Status
Users call the direction of a market inside a fixed time slot. That sounds like a simple CRUD app until you notice that scoring requires a price read at a precise instant, thousands of times, while a leaderboard recomputes underneath it.
- 3
- Asset classes - crypto, equities, forex
- Redis
- Hot path for price reads
- Slot
- Deterministic settlement window
The constraint
What made it hard
Hitting a market data provider once per prediction settlement is both slow and expensive, and two users settling in the same slot must see the same price or the game is not fair. Fairness here is a caching problem wearing a product costume.
Approach
01
Slots as the unit of truth
Predictions are bucketed into fixed windows. Settlement reads one canonical price per asset per slot, so every participant in a window is scored against an identical number by construction.
02
Redis in front of the feed
High-frequency price reads are served from Redis rather than the upstream provider, collapsing thousands of settlement reads into a single fetch per slot.
03
Typed schema with Drizzle
Drizzle keeps the PostgreSQL schema and the TypeScript types in one place, which matters when the scoring logic and the API contract must never disagree about a number.
04
Precomputed leaderboards
Rankings are computed on settlement and cached, not derived per request - the read path stays flat as participation grows.
Architecture
Specification
- Feeds
- Cache
- ORM
- Settlement
- Client
Stack
- Node.js
- React
- TypeScript
- PostgreSQL
- Redis
- Drizzle ORM
Where it landed
01
Settlement fairness guaranteed structurally rather than by convention.
02
Upstream data provider calls reduced to one per asset per slot.
03
Leaderboard reads decoupled from participant count.
Next case study
08
WiScribble
Digital signing and online notarisation
Something that has towork in production?
I take on contract engineering and full-time roles. Most useful first message: what you are building, what is currently in the way, and when you need it live.