Polymarket market-making bot
Videos
2 recorded1. Intro: walking through your post and the plan
Nov 9, 2026 · 5:33
2. Technical implementation: deployment, secrets and the two repos
Nov 9, 2026 · 3:50
Architecture, animated
ProposedArchitecture, detailed
Read from both reposwarproxxx/poly-maker: the base we keep 1,526 stars
- Stack: Python 3.12, asyncio + uvloop, py-clob-client-v2 (Polymarket CLOB V2), web3, websockets, httpx, pydantic, structlog, typer CLI.
- Storage: SQLite (tables positions, fills, order_log, pnl_snapshots) plus TOML config files (config, strategy profiles, market list). No external database.
- Market data: Gamma API scanner ranks markets by rewards + rebates vs volatility; a live order book per token from the market WebSocket.
- Pricing: fair value = depth-weighted microprice nudged by an EWMA of signed trade flow. Reservation r = FV − skew(inventory); half-spread δ = base + c_vol·σ + c_tox·toxicity. Bids YES at r − δ and NO at (1 − r) − δ.
- Exit: when both sides fill, merge.py merges the YES + NO pair back to USDC at the locked edge 1 − p − q, so it never crosses the spread.
- Risk: per-market notional cap, event-group cap, total exposure cap, daily-loss kill switch, stale-WebSocket halt, exchange heartbeat dead-man switch, and a regime machine (QUIET, TRENDING, EVENT, REDUCE_ONLY, HALTED).
- Gap: built for long-dated political markets, not 5- and 15-minute crypto rounds.
nexosdata/polymarket-market-maker-bot: the math we port 0 stars, 2 commits
- Stack: Python, numpy, httpx. A library plus a simulator, not a live trading engine.
- Pricing: Avellaneda-Stoikov in logit space for prices bounded 0 to 1. logit(r) = logit(mid) − q·γ·σ²·τ + OFI drift, with Bernoulli variance σ²·p(1 − p).
- Spread: S* = γσ²τ + (2/γ)·ln(1 + γ/κ). Wider with risk aversion γ, tighter with liquidity κ.
- Order flow imbalance (OFI) and depth imbalance come from its level-2 order book (orderbook.py).
- Risk: the adverse-selection guard cancels a resting quote when the mid moves 0.02 past it, but only inside SimulatedExecutionEngine. It has to be rebuilt as a live check.
- Port only market_maker/strategy.py and orderbook.py, behind unit tests, since the repo is a week old.
How the two merge One process
- poly-maker stays the engine: Gamma scanner, order gateway, rate limiter, reconciler, heartbeat, merge, SQLite state.
- nexosdata's logit A-S reservation price and spread replace poly-maker's quote step for the 5m/15m markets.
- The AS guard moves into poly-maker's reconciler as a live cancel on adverse mid moves.
- The Gamma scanner gets a 5m/15m Up/Down filter per coin (BTC, ETH, SOL), each switchable in config.
New for this job Built
- Fair value from Binance: a spot WebSocket per coin; P(Up) from the distance between spot and the round's strike price and the time left, giving Fair_Up and Fair_Down.
- The 0.97 rule, checked before every order: total USD spent on Up + Down must stay under 0.97 × the smaller share count. If buying a side would break it, stop buying that side and hold to settlement.
- Time cutoff: cancel_all 40 s before a 5m round and 90 s before a 15m round, then hold.
- Paper mode: poly-maker's --paper switch, exposed on the dashboard.
Dashboard, hosting and operations AWS eu-west-1
- Dashboard: FastAPI behind a login, served over HTTPS (Caddy). Start, stop and restart the bot; edit coins, 5m/15m toggles, size, spread and caps; live open orders, Up vs Down inventory and PnL read from the SQLite state.
- Host: your Ubuntu EC2 in eu-west-1 (Ireland). The bot runs as a systemd service with Restart=always; the dashboard is a second service.
- Setup as code: an Ansible playbook installs Python 3.12 + uv, the services, Caddy and the firewall, so the box can be rebuilt in one command. Docker is optional.
- Secrets: the wallet key lives in a root-only .env, never in the dashboard's config file or in git. Logs go to journald.
- Rollout: Milestone 1 runs paper mode against live markets; Milestone 2 goes live with a small burner wallet.
Questions for you
- How do you deploy today: is the EC2 instance already up, and do you use Docker or Terraform?
- poly-maker uses TOML config; is config.json a must, or is one TOML file the dashboard edits fine?
- Which wallet type: a plain EOA, a Gnosis Safe, or a Polymarket deposit wallet? It changes how merges are signed.
Meta prompt
For agents to understand this architecture
Harness
Have an agent explain the Polymarket market-making bot architecture
Read-only. One paste. Ends in a brief.
You are going to understand the architecture Tyler Youk proposes for Polymarket market-making bot, well enough to explain it to an engineer who has never seen it and to argue with it. Nothing on the diagram is built yet: every box marked proposed is a design, not a claim that something runs.
Rule 0: read only.
Do not edit, create or delete any file on my machine. This is a read-and-report task from start to finish. If you need to ask me anything, ask with {{ASK}}.
Step 1: read the proposal.
Fetch https://clients.tyleryouk.com/polymarket-mm-bot.md: the job, every label of the architecture diagram as text, and the detailed architecture. Read it in full before forming a view.
Step 2: read the code it builds on.
Open every repository or service the page names and read its README, dependency file and the modules the page cites. If you can run subagents, read each one in parallel. Note where the page's description of a repo and the repo itself disagree.
Step 3: explain the architecture.
1. The system in one paragraph: what goes in, what comes out, and what it is for.
2. Each component in data-flow order: what it does, which repo it comes from or whether it is new, its tech stack, and what it depends on.
3. The data and state: what is stored, where, and in what format.
4. Where it runs and how it is deployed, started, stopped and updated.
5. The riskiest part to build, and why.
6. What is missing, wrong or over-built, and what you would ask Tyler about it.
Company info
Researched 2026-11-09- Upwork profile: Saudi Arabia, Finance & Accounting, small company (2–9 people), member since Oct 30, 2026, payment verified, 1 job posted, 0 hires.
- The post's pricing module is nexosdata/polymarket-market-maker-bot, published by the GitHub account nexosdata (created Oct 30, 2026; 12 repos, all prediction-market tools, homepage naxosdata.com).
- naxosdata.com was registered Oct 30, 2026: NaxosData, a prediction-market data API. Synchronized L2 order-book and tick data across Polymarket, Kalshi, ForecastEx, Limitless, PredictIt, Drift BET and Smarkets; REST at api.naxosdata.com/v1, WebSocket/SSE streams, Python and TypeScript SDKs, MCP servers.
- NaxosData pricing: Hobbyist $0, Quant Pro $30/mo, Institutional $100/mo ("for macro funds, market makers & primes"). No people or location are named on the site.
- Where it fits: NaxosData's historical L2 archives could back-test the bot's paper mode before Milestone 2.