01 / MATCHING
Contract Order Routing & Matcher
Separate order-api, order-router, entrust, contract-matcher and execution-router maintain deterministic price-time priority per perpetual contract.
GO PERPETUAL FUTURES ENGINE · 25 DEDICATED SERVICES
Spot order books are easy to mock; derivatives break in production when liquidations, mark-price jitter and funding settlement collide with matching latency. The ffex Go contract domain isolates each critical invariant into 25 dedicated microservices.
01 / DERIVATIVES ARCHITECTURE
Built inside exchange/go/contract and options settlement with clear domain separation and versioned internal contracts.
01 / MATCHING
Separate order-api, order-router, entrust, contract-matcher and execution-router maintain deterministic price-time priority per perpetual contract.
02 / MARGIN & POSITION
contract-position and position cache/sync services enforce explicit margin modes, leverage tiers and immutable balance invariants with zero float drift.
03 / MARK PRICE
contract-price computes composite index and mark prices independently from thin order-book wicks to prevent artificial liquidation cascades.
04 / FUNDING RATE
contract-clearing-fundrate executes periodic funding settlements between long and short positions with deterministic idempotency keys.
05 / LIQUIDATION
contract-clearing-liquidation monitors margin ratios and takes over distressed positions cleanly without starving normal user order flow.
06 / ADL & OPTIONS
contract-clearing-reduction handles bankruptcy tail events when insurance buffers hit limits, alongside biz options-settlement for directional contracts.
02 / DERIVATIVE SAFETY INVARIANTS
Every design rule below directly addresses the failure modes that bankrupt un-audited exchange clones during sharp market swings.
Order books and position ledgers never race over cross-service database locks; ordering comes from explicit single-writer event streams.
Burst liquidation checks run in clearing-liquidation and clearing-router so cascading margin calls never stall maker order cancellations.
Liquidation triggers follow index-anchored mark prices rather than single shallow last-trade prints.
Tick size, contract multiplier, leverage, funding fees and closing PnL execute strictly with decimal arithmetic and traceable ledger entries.
Matcher caches, position sync and market sync reconstruct consistent state from ordered event streams after pod restarts or node replacement.
03 / GO CONTRACT SERVICES
Included in the Go CEX source license alongside spot, custody and admin modules.
PERPETUAL FUTURES FAQ
Yes. Margin modes, leverage caps, contract specs and clearing rules are modeled explicitly across contract-position, contract-price and clearing services, with USDT-margined and coin-margined contract flows supported.
Margin evaluation, liquidation takeover and ADL reduction execute in dedicated clearing services (`contract-clearing-liquidation`, `contract-clearing-reduction`) separated from the matching hot path.
The codebase includes `fufeng-marketmaker-runner` alongside signed OpenAPI and WebSocket gateways (`contract-openapi`, `contract-market-websocket`) so you can connect internal hedging bots or external institutional liquidity providers cleanly.
Derivatives are normally delivered within the unified Go CEX platform together with user center, decimal ledger, wallet custody and operations admin — or scoped under joint build if you already operate part of the stack.
BOOK A TECHNICAL DEEP DIVE
Discuss contract specs, liquidation buffers, liquidity APIs and deployment sizing directly with the engineering team.