Titus — a productized low-latency trading system for Polymarket
What it is: a complete trading operation in software — market data, execution, settlement, strategy, remote control, and operations tooling — built so that one person (including a non-technical operator) can run market-making strategies on Polymarket safely.
The problem
Polymarket pays liquidity providers through a rewards program: keep double-sided resting depth near the mid, earn payouts. Capturing that yield profitably is harder than it sounds. Resting orders risk getting filled — turning a rewards trade into a directional loss. Eligibility depends on live book conditions. Execution must be fast enough to pull quotes before adverse flow hits. And every on-chain leg — CTF split/merge/redeem, Safe signing, token approvals — is a place where a denomination or nonce error is a direct loss of funds.
Most traders and funds want the yield and the data without building low-latency infrastructure, credential handling, and CTF plumbing themselves. Titus packages all of it.
Architecture
The system is a set of processes joined by NATS. A publisher turns Polymarket's CLOB WebSocket into a normalized market-data stream; an executor holds the signing key and handles order placement plus CTF settlement through Polymarket's relayer. Strategy apps hold no credentials at all — only parameters and a public wallet address — and talk to the system through an SDK. That separation is the core trust property: a strategy bug, or even a malicious strategy config, cannot touch keys or move funds outside the executor's guarded paths.
A strict hot-path discipline governs every per-market-update code path: no async on the hot path, no allocations in loops, no logging, circuit breakers instead of throws. Money math uses branded integer units — no floats anywhere near funds.
Hard problems solved
- Market making that must not get filled. The LP-rewards strategy earns from rewards, not spread — so each side is evaluated per book event against a velocity-based hazard signal that watches how fast the depth cushion in front of the quotes is draining, and pre-emptively cancels before adverse flow arrives. Accidental fills are unwound to flat automatically.
- Delta-neutral volume with an enforced invariant. A four-slot strategy sizes bids by signed inventory imbalance so a full double-fill nets flat, checks its economic invariant every tick, and suppresses asks before a merge dispatch to close a race that would otherwise revert on-chain mid-settlement.
- Polymarket's V2 settlement migration, absorbed in production. When Polymarket moved to its V2 collateral-adapter model — new adapters, wrapped collateral, five distinct approval slots — Titus migrated with config-threaded routing so approvals and routing can never split-brain. When Polymarket rotated adapter addresses with no notice, the change shipped same-day.
- Safe signing under a nonce race. Live settlement transactions intermittently reverted because the local nonce view lagged the chain. Fixed by reading the on-chain nonce immediately before signing, signing the max of local and chain views, and gating retries on a confirmed on-chain revert — not a guess.
- Remote control without exposing keys. A separate command plane lets strategies be operated from a phone: an internet-facing gateway that holds only a public verification key, Ed25519 scope-proof authorization, and a dedicated command bus isolated from the trading bus — deployed across four AWS regions behind Cloudflare, torn down and rebuildable from Terraform with state preserved.
- Safe for a non-technical operator. One CLI: validate → config snapshot → restart → 60-second health gate → automatic rollback, with Telegram alerts and an emergency stop. Systemd units fail safe rather than crash-loop. This is what "productized" means — the client operates it without me.
Proof
The system is deployed for a client and runs live. Performance depends on strategy parameters and capital; live trading results are available on request — I'd rather walk you through real numbers on a call than put unverifiable claims on a page.
Want this for your book or your product? A strategy build on this stack is a fixed-scope engagement, not a research project.
Book 30 minutes