Skip to main content
The CLI trades Polymarket prediction markets from a Polymarket account linked to the agent wallet. Money moves in one loop: USDC goes from the agent wallet into Polymarket, trades happen there, and withdrawals come back to the agent wallet as USDC. In session mode, deposits count against the allowance. Trades and withdrawals happen inside the Polymarket account, so they don’t. Polymarket isn’t available in every region. The CLI checks at run time and stops with region_blocked, or allows only closing positions with region_close_only.

Set up and fund the account

1

Check the account

Start here every time. It shows whether the account is set up, the balance, the region, and any winnings to redeem.
2

Create the account

No POL or key import is needed. It’s safe to run again.
3

Deposit

The minimum is $2. The command waits up to five minutes for the deposit to be credited. If it isn’t credited yet, run status later. Don’t deposit again while one is pending.

Find a market

A <ref> is a market’s conditionId, its slug, or an event slug. The outcome is yes, no, or an outcome’s name. For an event with several outcomes, name the entry, and add no for its no side, such as "Bob no".

Place a prediction

Preview the buy, then set --max-price a little above the preview’s estimatedPrice:
The dollar amount includes fees, so a buy never spends more than you pass. If the fill price would be worse than --max-price, nothing is posted (price_guard). To rest a limit order instead, pass --price, and optionally --expires <minutes> (at least 3):

Close a position

sell takes a number of shares or all. cancel takes an order ID, --all, or --market <ref>.

Collect winnings and withdraw

Redeemed winnings land in the Polymarket account. withdraw sends them to the agent wallet as USDC on Polygon. The minimum is $2.

Track performance

If something fails