flux Perpetual futures exchange
A perpetual futures exchange with an in-memory matching engine.
Links
Overview
Flux is a perpetual futures exchange, from the matching engine up to the trading screen. It handles the full trade lifecycle: order matching, margin, funding rates, liquidations and auto-deleveraging, with updates pushed to clients over WebSockets.
The matching engine keeps the order book in memory and takes snapshots it can recover from. Trades and state changes travel between services on Redis Streams, and background workers write them to PostgreSQL through Prisma. Mark prices come from Binance's futures WebSocket feed.
Matching, risk, persistence and the WebSocket hub are separate TypeScript packages, each with deterministic tests. The frontend is Next.js and Tailwind.