A Polymarket trading system its operator can watch and stop
Titus is Mihir's own trading system for Polymarket, built to run around the clock, and other traders run it too. Strategies hold no signing key, Grafana shows its metrics and logs, and Telegram carries its alerts and its emergency stop.
- Client
- Mihir's own build, run by him and other traders
- Services
- Blockchain, Data
- When
- Since December 2025
- Team
- Mihir
- Status
- Live
The problem
Polymarket pays liquidity rewards to market makers who keep resting orders close to the middle of the book. Mihir wanted to earn those rewards on his own capital, with strategies that run day and night.
A strategy is a few rules. Around it sit the market-data feed, order placement, on-chain token operations and wallet signing. In each of these parts, a wrong unit or a missed fill in an automated trade is a direct loss of money.
A system that trades while nobody is watching needs a way to show its operator that something has failed, and a way to stop it.
What we built
Titus is a set of processes joined by NATS messaging. The strategies make the trading decisions, and no strategy holds the signing key.
A publisher streams Polymarket's order books and the wallet's own fills in. An executor places orders and runs the on-chain operations: splitting, merging and redeeming outcome tokens through Polymarket's relayer. The signing key lives only in the publisher and the executor. Each strategy talks to them through a shared SDK and holds only its parameters and the wallet's public address.
Prices, share sizes and USDC amounts are separate integer types. Rounding is always an explicit step in the code.
The split has two costs. An order crosses the message bus before it reaches the venue. If the processes disagree about which wallet they serve, most of the faults that follow are silent. Mihir accepted both costs so that strategy code can change without wallet handling in every strategy.
Titus sends its alerts to the operator's phone and checks every restart. Each service publishes its logs, metrics and alerts on a separate NATS bus, apart from trading traffic. A log collector reads that bus, ships the logs to Loki and serves the metrics to Prometheus. The collector keeps its counters on disk, so a collector restart does not show up as a false spike in the rates.
Grafana shows an operations home page and a dashboard per strategy. Prometheus rules flag a halted strategy or a climbing error rate.
The services raise alerts such as a strategy halting, a circuit breaker tripping or a restart's outcome. A Telegram bot forwards these alerts to one allowed chat. The same chat sends commands back: status, config, recent logs, a link to the dashboards, and a halt. The operator must confirm a halt within 30 seconds before it stops a strategy.
The titus command line runs each restart in a fixed order. It validates the config, saves a snapshot, restarts the service, then waits up to 60 seconds for the strategy to report a healthy start. Telegram gets a restart-OK or restart-failed alert either way. If the restart fails, the command line compares the config with the previous snapshot. When the two differ, the command line asks the operator whether to roll back to that snapshot. With no answer in 60 seconds, the command line leaves the strategy stopped.
What was hard
Mihir closed two on-chain races: a lagging nonce and a sell during a merge.
The trading wallet is a Safe. A Safe numbers its transactions with a nonce, and each transaction must carry the next number. Live transactions reverted because the local nonce count fell behind the chain. The local count started from the relayer's view, which lagged the chain.
Mihir changed the signer to read the nonce on-chain right before signing. He also changed it to retry once, and only after a confirmed reverted receipt, rather than retrying every uncertain submission.
The volume strategy had a second race. A sell that settles while the same tokens are being merged leaves the merge short, and the merge reverts. The strategy now sizes its sells from settled on-chain balances, and it holds its sells in the tick before a merge.
In June 2026 Polymarket's relayer began refusing the previous collateral adapters, the contracts that split, merge and redeem outcome tokens. Every part that routes or approves takes the adapter addresses from one config. Moving to the new pair was one change.
The result
Titus trades for Mihir and for other traders.
On Mihir's own capital, the LP-rewards strategy returned about 1 to 2% per day while it ran live. The volume strategy generated $10,000 of volume for about $400 in spread and fees.
One of the other traders trades from a US$450k wallet and has run US$4M in volume through Titus.
Built with
| Services | TypeScript on Bun |
|---|---|
| Messaging | NATS and JetStream |
| Chain access and signing | viem, with Safe transactions signed as EIP-712 on Polygon |
| Money math | Integer unit types on BigInt |
| Metrics, logs and dashboards | Prometheus, Loki and Grafana |
| Alerts and emergency stop | Telegram bot |
| Operations | systemd units and the titus command line |
| Building | Claude Code |