Circuit

Polymarket trading agent in Python vs Circuit

Updated by the Circuit team

Start with the right library

Most Polymarket bot tutorials still reference py-clob-client, which is now archived (its README says it "is no longer functional and should not be used for new or existing integrations"), and its successor py-clob-client-v2 is deprecated too.

Polymarket's current Python SDK is polymarket-client from Polymarket/py-sdk (pip install polymarket-client), with sync and async PublicClient and SecureClient classes. The TypeScript equivalent is @polymarket/client. Polymarket's docs include a migration guide from the old CLOB, relayer and builder-signing clients.

Popular open-source agents on GitHub with stars as of October 17, 2026:

RepositoryStarsLicenseWhat it does
Polymarket/agents3,800MITPolymarket's AI agent framework, last updated November 2024
warproxxx/poly-maker1,512MITMarket making bot that quotes both sides of the book
Polymarket/py-clob-client1,227MITArchived CLOB client
sterlingcrispin/nothing-ever-happens981CC0-1.0Buys No on every non-sports market, "mostly a meme" per its author

Check the last commit date and the client library before you copy an agent. Code built on the archived client will not run as written. That client's README says so.

What a Python agent must handle

Each row is a step your code owns when you build on the SDK. The right column is what Circuit does for an agent written with its Polymarket SDK.

StepWhat Polymarket requiresHow Circuit handles it
AccountA Deposit Wallet, the default for accounts deployed on or after May 4, 2026. Proxy and Safe wallets are legacyDeploys the Deposit Wallet for wallets it created. Imported wallets need a deployed Deposit Wallet or an eligible EOA
AuthenticationL1: an EIP-712 wallet signature to create or derive API keys. L2: HMAC headers on every orderThe engine derives CLOB credentials and signs orders. Your agent code never holds a key
CollateralpUSD, an ERC-20 on Polygon backed by USDC. Wrapping USDC.e needs an approval of the CollateralOnramp firstPrepares funding and wrapping as separate actions you review
Allowances and gasEOAs set token allowances before trading. Gasless wallet actions need a Relayer API keyApprovals run as their own operations. Deposit Wallet actions go through the relayer, and EOAs pay Polygon gas
Order rulesPrices on the market's tick size, sizes above its minimum. GTC, GTD, FOK and FAK order typesBuys take a pUSD amount that includes fees, sells take shares and round down to venue precision
SettlementMatches settle onchain asynchronously, so you wait for settlement before reading positionsObserves fills and keeps settlement receipts on each operation
ResolutionWinning shares redeem for $1, losing shares for $0. You call redemption yourselfpositions.redeem redeems both outcomes of a resolved market in one action
Restricted keysSession Keys, in beta, trade for up to 180 days and cannot withdraw. Authorizing one needs a Builder API keyAgents never hold a key. Every signature needs the permit you signed with your passkey when the agent started

Worked example: fees and break-even

Polymarket charges takers a fee of C × feeRate × p × (1 − p). C is shares and p is the price. Makers pay nothing. Geopolitics markets are fee-free. Rates in Polymarket's fee table range from 0.04 for politics, finance and tech to 0.07 for crypto.

Buy 100 YES shares in a sports market at $0.40 with a fee rate of 0.05:

  • Cost of shares: 100 × $0.40 = $40.00
  • Taker fee: 100 × 0.05 × 0.40 × 0.60 = $1.20
  • Total paid: $41.20
  • Payout if YES wins: $100.00 for a profit of $58.80
  • Break-even probability: $41.20 ÷ $100 = 41.2% against the 40% the price implies

The same 100 shares at $0.50 in a crypto market cost $1.75 in fees (the peak of the fee curve), so taking liquidity on thin edges can wipe out your profit. Circuit's orders.quote includes Polymarket's fees in the quoted price. An agent can compare its estimate against the real cost before it buys.

Resolution is slower than you think

Per Polymarket's docs most markets resolve through the UMA Optimistic Oracle. A proposer posts a bond of typically $750 pUSD. Then a 2-hour challenge period runs. Undisputed markets resolve about 2 hours after the proposal. A disputed market adds a 24 to 48 hour debate and about 48 hours of UMA voting. That can take several days. A market judged unknown resolves 50/50 and each share redeems for $0.50. Up-down crypto markets resolve from a Chainlink TWAP instead.

A DIY agent needs to track all of this: which markets it holds, which have resolved, and which need a redeem call. On Circuit, a Polymarket resolution trigger in circuit.toml wakes the agent when a market resolves so it can call positions.redeem for each resolved holding. See Polymarket trading agents for the full set of Circuit actions.

How Circuit runs the same agent

A Circuit agent is TypeScript. A minimal loop that buys longshots below a price looks like this in prose:

  1. Call agent.polymarket.markets.screen with endsWithinMs, a price band (lowestPricePusd: 0.03, highestPricePusd: 0.10), a minLiquidityPusd floor, and your planned stake.
  2. For each candidate, call orders.quote with a spotBuy amount in pUSD to get the fee-inclusive price.
  3. Call orders.create for candidates passing your rule, sized from the session's pUSD in agent.allocation.
  4. On each run, call positions.redeem for holdings marked redeemable.

The SDK also splits pUSD into both outcomes, merges them back, and converts No shares across a negRisk event. Redemption readiness comes from onchain resolution. Each operation keeps its fills and settlement receipts.

You can build the same agent without code. Describe it to Circuit and the Builder writes it. Then paper trade it. In paper trading Polymarket orders fill against the live order book and redemptions pay each market's real resolution. Circuit's backtester covers Hyperliquid and Lighter perps only. Polymarket strategies are tested on paper. Read crypto paper trading for how paper fills work. Read Polymarket trading agent with Claude to build one in a chat.

To inspect how production Polymarket Perps agents set parameters and cost gates, read the strategy reports for ANTHROPIC View and Polymarket H100 Pool Farm.

Telegram bots and hosted services

Searches for a Polymarket Telegram bot lead to hosted services that trade for you from a chat. Any such service must hold a key that can sign for your Polymarket account. Ask which key. If it holds the owner key of your wallet it can withdraw everything. Polymarket's docs say a Session Key can trade for up to 180 days and cannot withdraw. Never paste a private key or seed phrase into a chat.

Circuit is also hosted, but its wallets are self-custodial. Circuit keeps the signing key in a hardware enclave and agents never see it. Nothing is signed without a permit you sign with your passkey. You can export the key from Settings at any time.

When Python is the better choice

Write it yourself in Python if your edge comes from a model trained with scikit-learn or PyTorch. Python also wins if you need to quote both sides of many books at once like poly-maker does. It wins if you want Polymarket's newest features such as Combos on the day they ship (Circuit already supports Polymarket Perps). You also avoid depending on any platform.

Use Circuit if you want the agent hosted with key handling and redemption done for you. Circuit can also pair a prediction with a Hyperliquid perp in the same agent. Circuit charges no builder fee on Polymarket. For a market making approach, see the market making agent guide.

Test before you risk money

Agents start in paper trading by default, using paper funds on live markets with no real money at risk (agents starting from an open position run on real money only). Perp, spot, Polymarket, and swap orders simulate live order books, quotes, venue fees, funding, and liquidation rules. Polymarket redemptions settle against real market resolutions. Every paper-capable agent also runs a public $1,000 paper trading benchmark, and you can switch to real money whenever the results convince you.

What it costs

Circuit has no subscription. It charges 0.01% on Hyperliquid perp orders and spot sells (up to 0.01% on Hyperliquid outcomes) and on most swaps, and 0% on Polymarket, Lighter, Derive, Kraken, and Papertrade. Venue trading fees, network gas, and bridge or routing fees still apply; each proposal's Review shows reported costs before you confirm. See Pricing for the full schedule.

FAQ

Is py-clob-client still supported?

No. Polymarket archived py-clob-client and deprecated py-clob-client-v2. Use polymarket-client from Polymarket/py-sdk (pip install polymarket-client).

How do I get Polymarket API keys?

The CLOB uses two levels. An L1 EIP-712 signature from your wallet creates or derives API credentials. L2 HMAC headers built from those credentials sign each order request. The unified SDK's SecureClient does both. Gasless wallet actions also need a Relayer API key from polymarket.com settings.

Does a Polymarket agent need USDC or pUSD?

pUSD. It is Polymarket's ERC-20 collateral on Polygon. USDC backs it. You wrap USDC.e through the CollateralOnramp contract or deposit through Polymarket's bridge. The bridge wraps for you.

Can a Polymarket agent redeem winnings automatically?

Yes if you code it. Winning shares redeem for $1 after resolution. On Circuit, a resolution trigger wakes the agent and positions.redeem redeems both outcomes of a resolved market in one action.

Is there a Polymarket agent on GitHub I can use?

Polymarket/agents is the official AI agent framework. It was last updated in November 2024. warproxxx/poly-maker is a popular market maker. Check that any agent uses the unified SDK and pUSD before you fund it.

Can I paper trade Polymarket?

Polymarket's docs describe no paper trading mode. Circuit paper trading fills Polymarket orders against the live order book and pays real resolutions with paper pUSD.

Trade it on Circuit.

Build it or fork it. Backtest it and run it in Paper trading before using real money.

Run It