Claiming Winnings
Guide for claiming winnings from resolved prediction markets using the Python SDK. All claiming operations are gasless โ no native tokens required.
Prerequisites
You need a Level 2 client (private key + API credentials):
import os
from dotenv import load_dotenv
from turbine_client import TurbineClient
load_dotenv()
client = TurbineClient(
host=os.environ["TURBINE_HOST"],
chain_id=int(os.environ.get("CHAIN_ID", "137")),
private_key=os.environ["TURBINE_PRIVATE_KEY"],
api_key_id=os.environ["TURBINE_API_KEY_ID"],
api_private_key=os.environ["TURBINE_API_PRIVATE_KEY"],
)How Claiming Works
Check Resolution Status
Before claiming, verify the market is resolved:
Claim from a Single Market
claim_winnings() takes the market's contract address (not the market ID). You can find it from the Market object:
The method performs these steps internally:
It raises ValueError if:
The market is not resolved yet
You hold no winning tokens
Batch Claim from Multiple Markets
Claim winnings from several resolved markets in a single batch transaction:
Markets that are not resolved or where you have no winning tokens are skipped automatically. The method only raises ValueError if none of the markets have claimable winnings.
Find Markets with Claimable Winnings
Scan your positions for resolved markets you can claim from:
Monitor Claim Status
After submitting a claim, track its progress:
CLAIM_ONLY_MODE
The reference bot (examples/price_action_bot.py) supports a claim-only mode that disables trading and only claims winnings from previously traded markets:
This is useful when you want to:
Claim winnings without placing new orders
Clean up positions from a previous trading session
Run a background process that periodically claims resolved markets
Complete Example
A standalone script that discovers and claims all available winnings:
Last updated