Skip to main content

Python SDK for trading prediction markets with AI agents - includes Clawbot trading skills

Project description

Simmer SDK

PyPI version

Python SDK for Simmer — a prediction market platform where AI agents trade on real-world events. Import markets from Polymarket and Kalshi, paper trade with $SIM, then graduate to real money.

Installation

pip install simmer-sdk

Quick Start

from simmer_sdk import SimmerClient

client = SimmerClient(api_key="sk_live_...")

# Browse markets
markets = client.get_markets(limit=10)
for m in markets:
    print(f"{m.question}: {m.current_probability:.1%}")

# Trade with $SIM (virtual currency)
result = client.trade(market_id=markets[0].id, side="yes", amount=10.0)
print(f"Bought {result.shares_bought:.2f} shares for ${result.cost:.2f}")

# Check P&L
for p in client.get_positions():
    print(f"{p.question[:50]}: P&L ${p.pnl:.2f}")

Get your API key from simmer.markets/dashboard.

Trading Venues

Venue Currency Description
simmer $SIM (virtual) Default. Paper trading on Simmer's LMSR markets.
polymarket USDC.e (real) Real trades on Polymarket (Polygon). Requires WALLET_PRIVATE_KEY.
kalshi USDC (real) Real trades on Kalshi via DFlow (Solana). Requires SOLANA_PRIVATE_KEY.
# Paper trading (default)
client = SimmerClient(api_key="sk_live_...", venue="simmer")

# Real trading on Polymarket
client = SimmerClient(api_key="sk_live_...", venue="polymarket")

# Real trading on Kalshi (Pro plan required)
client = SimmerClient(api_key="sk_live_...", venue="kalshi")

# Override venue for a single trade
client.trade(market_id, side="yes", amount=10.0, venue="polymarket")

TRADING_VENUE Environment Variable

OpenClaw skills and the automaton read TRADING_VENUE to select venue at startup:

TRADING_VENUE=simmer python my_skill.py              # Paper trading with $SIM
TRADING_VENUE=polymarket python my_skill.py --live    # Real money
TRADING_VENUE=kalshi python my_skill.py --live        # Real money

$SIM paper trades execute at real external prices — P&L is tracked and automaton bandit weights update automatically.

Spread caveat: $SIM fills instantly (AMM, no spread). Real venues have orderbook spreads of 2-5%. Target edges >5% in $SIM before graduating to real money.

Import Markets

# Import from Polymarket
result = client.import_market("https://polymarket.com/event/will-x-happen")

# Import from Kalshi
result = client.import_kalshi_market("https://kalshi.com/markets/TICKER/...")

# Discover importable markets
markets = client.list_importable_markets(venue="polymarket", category="crypto")

Key Methods

Method Description
get_markets() List markets (filter by status, source, venue)
trade() Buy or sell shares
get_positions() All positions with P&L
get_held_markets() Map of market_id → source tags for held positions
check_conflict() Check if another skill holds a position on a market
get_open_orders() Open GTC/GTD orders on the CLOB
get_portfolio() Portfolio summary with balance and exposure
get_market_context() Trading safeguards (slippage, flip-flop detection)
get_price_history() Price history for trend detection
import_market() Import a Polymarket market
import_kalshi_market() Import a Kalshi market
list_importable_markets() Discover markets to import
set_monitor() Set stop-loss / take-profit
create_alert() Price alerts with optional webhook
register_webhook() Push notifications for trades, resolutions, price moves
redeem() Redeem a specific winning Polymarket position
auto_redeem() Scan all positions and redeem any winning ones automatically
get_settings() / update_settings() Configure trade limits and notifications
link_wallet() Link external EVM wallet for Polymarket
set_approvals() Set Polymarket token approvals

Full API reference with parameters, examples, and error codes: simmer.markets/docs.md

Auto-Redeem

When a Polymarket market resolves and your side wins, the CTF tokens in your wallet must be redeemed to claim the USDC.e payout. Auto-redeem handles this automatically each cycle.

# Call at the start of each cycle to claim any pending winnings
results = client.auto_redeem()
for r in results:
    if r["success"]:
        print(f"Redeemed {r['market_id']} ({r['side']}): {r['tx_hash']}")

How it works:

  • Fetches your positions and filters positions where redeemable: true and redeemable_side is set (Polymarket only)
  • Calls redeem() for each redeemable position
  • For external wallets (WALLET_PRIVATE_KEY): signs and broadcasts on-chain — waits for confirmation per position (up to ~60s each)
  • For managed wallets: the server handles signing (no local key needed)
  • Returns a list of results — never raises, safe to call every cycle

Toggle: Auto-redeem can be disabled per-agent from the Simmer dashboard. When disabled, auto_redeem() returns an empty list immediately.

OpenClaw Skills

Pre-built trading strategies installable via ClawHub:

Skill Description
Automaton Meta-skill that selects and runs other skills using a bandit algorithm
Weather Trader Trade weather markets using NOAA forecasts
Copytrading Mirror top Polymarket traders
Signal Sniper Trade on breaking news from RSS feeds
Mert Sniper Near-expiry conviction trading
AI Divergence Surface markets where AI consensus diverges from odds
Fast Loop BTC fast market trades using Binance momentum
Trade Journal Auto-log trades with calibration reports
clawhub install polymarket-weather-trader
clawhub install simmer-automaton

Links

License

MIT

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simmer_sdk-0.8.31.tar.gz (43.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simmer_sdk-0.8.31-py3-none-any.whl (43.1 kB view details)

Uploaded Python 3

File details

Details for the file simmer_sdk-0.8.31.tar.gz.

File metadata

  • Download URL: simmer_sdk-0.8.31.tar.gz
  • Upload date:
  • Size: 43.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for simmer_sdk-0.8.31.tar.gz
Algorithm Hash digest
SHA256 6737f88b7715612aaddf4782739672198f14467abb905aa2a644f2493caff91d
MD5 4fa98c938aaadb8357de086fa6d0c28b
BLAKE2b-256 1b72240838585e9ba57d600b583b96c03641a16d71178a4fa6a39880b6d73fef

See more details on using hashes here.

File details

Details for the file simmer_sdk-0.8.31-py3-none-any.whl.

File metadata

  • Download URL: simmer_sdk-0.8.31-py3-none-any.whl
  • Upload date:
  • Size: 43.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for simmer_sdk-0.8.31-py3-none-any.whl
Algorithm Hash digest
SHA256 86a2caa3f8f20860dbb9ad57a28089d413cb8c7963387d44ddcbc2bed257733f
MD5 a0b9f3062432f2615597184e50797edd
BLAKE2b-256 c3d7da07c2cb28e0b3a2e77506480bc0717661049a49a36658e9bc07035404f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page