Your agent holds a wallet and can already pay for things. The moment it needs to trade a prediction market, most teams bolt on a second client, copy another set of credentials into another env file, and hand the agent a second set of keys. That is one more thing to leak and one more balance to watch.
The Polymarket venue tools in the OpenClawCash API keep the trading inside the wallet the agent already has. Search a market, turn the outcome you want into a token id, place an order, read your positions, redeem when the market resolves. One wallet, one API key, and the same policy layer that guards a normal transfer guards the order too.
Every route below is copied from the public reference at https://openclawcash.com/docs.
The one header every call uses
X-Agent-Key: occ_your_api_key
1. Link the wallet to the venue once
Polymarket setup is user-managed in the dashboard at /venues/polymarket, and it expects a polygon-mainnet wallet. You do this once per wallet, not per order. Access is gated by the venue_access policy, so a wallet whose policy does not allow the venue cannot trade through it even if the agent tries.
2. Find the market
When you have a question in words, search the venue for candidate markets:
curl "https://openclawcash.com/api/agent/venues/polymarket/market/search?query=election+2028&limit=10" \
-H "X-Agent-Key: occ_your_api_key"
Each item comes back with its slug, question, conditionId, active and closed flags, and the outcomes list. Use the slug for the next step.
3. Turn an outcome into a token id
Orders are placed against a CLOB tokenId, not a human word, so resolve the market first:
curl "https://openclawcash.com/api/agent/venues/polymarket/market/resolve?slug=us-presidential-election-2028&outcome=No" \
-H "X-Agent-Key: occ_your_api_key"
The response gives you the resolved market plus an outcome block with its tokenId, and the full outcomes list with the selected one flagged. Take that tokenId into the order call.
4. Place an order
A limit order names a price and a size:
curl -X POST https://openclawcash.com/api/agent/venues/polymarket/orders/limit \
-H "Content-Type: application/json" \
-H "X-Agent-Key: occ_your_api_key" \
-d '{
"walletId": "Q7X2K9P",
"tokenId": "1234567890",
"side": "BUY",
"price": 0.62,
"size": 25
}'
A market order names an amount and an order type instead:
curl -X POST https://openclawcash.com/api/agent/venues/polymarket/orders/market \
-H "Content-Type: application/json" \
-H "X-Agent-Key: occ_your_api_key" \
-d '{
"walletId": "Q7X2K9P",
"tokenId": "1234567890",
"side": "BUY",
"amount": 25,
"orderType": "FAK",
"worstPrice": 0
}'
Both answer with venue, status, orderId and txHash.
5. Read and cancel what is open
curl "https://openclawcash.com/api/agent/venues/polymarket/orders?walletId=Q7X2K9P&status=OPEN&limit=50" \
-H "X-Agent-Key: occ_your_api_key"
To pull an order, send its id back:
curl -X POST https://openclawcash.com/api/agent/venues/polymarket/orders/cancel \
-H "Content-Type: application/json" \
-H "X-Agent-Key: occ_your_api_key" \
-d '{ "walletId": "Q7X2K9P", "orderId": "order_id_here" }'
6. Track positions, then redeem
Open positions, filtered to open markets:
curl "https://openclawcash.com/api/agent/venues/polymarket/positions?walletId=Q7X2K9P&limit=100" \
-H "X-Agent-Key: occ_your_api_key"
When a market resolves, list what can be claimed and redeem it:
curl "https://openclawcash.com/api/agent/venues/polymarket/redeemable?walletId=Q7X2K9P&limit=100" \
-H "X-Agent-Key: occ_your_api_key"
curl -X POST https://openclawcash.com/api/agent/venues/polymarket/redeem \
-H "Content-Type: application/json" \
-H "X-Agent-Key: occ_your_api_key" \
-d '{ "walletId": "Q7X2K9P", "tokenId": "1234567890", "limit": 100 }'
Pass a tokenId to redeem one position, or omit it to sweep every redeemable position on the wallet. The redeem picks its signing path from the wallet's configured signatureType: 0 signs directly on chain from the wallet's EOA and pays a little POL for gas, 1 and 2 redeem through Polymarket's gasless relayer. An optional signatureType on the call asserts the path and returns 400 on a mismatch.
What is still rough
Being straight about the edges, because the docs are:
- The link is a dashboard step, not an API call. Plan for a human to do it once per wallet, not for the agent to self-provision the venue.
- It is a
polygon-mainnetproduct. The wallet has to live on that network for the venue tools to touch it. - The
venue_accesspolicy gates the whole surface, so a wallet policy can block an order before it is ever signed. That is the point, but it means an agent that never checked its policy will see a403, not a filled order. - Closing a position on a market order defaults to a
SELLwhere theamountis shares, not dollars.
The full endpoint reference, with every request and response field, is at https://openclawcash.com/docs.
Top comments (0)