Skip to main content
This guide will get you from zero to a working trade on Turbine’s prediction markets.

Installation

Install the SDK via pip:
pip install turbine-py-client

Setup credentials

1

Create a wallet

You need an Ethereum-compatible wallet. The easiest way is to export your private key from MetaMask:
  1. Open MetaMask browser extension
  2. Go to Settings → Security & Privacy → Export Private Key
  3. Copy your private key (starts with 0x)
Never share your private key. Keep it secure and only use it in trusted environments.
2

Configure environment variables

Create a .env file with your credentials:
TURBINE_PRIVATE_KEY=0x...
TURBINE_API_KEY_ID=
TURBINE_API_PRIVATE_KEY=
CHAIN_ID=137
TURBINE_HOST=https://api.turbinefi.com
Leave TURBINE_API_KEY_ID and TURBINE_API_PRIVATE_KEY blank. They’ll be auto-generated on first run and saved back to your .env file.
3

Fund your wallet

Get USDC on Polygon:
  • Minimum: ~$10 USDC on Polygon mainnet
  • USDC contract: 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359
  • Bridge: Use the Polygon Bridge or withdraw directly from an exchange
You do NOT need MATIC or any other gas tokens. Turbine is fully gasless.

Your first trade

Here’s a complete example that places a limit order on the current BTC market:
from turbine_client import TurbineClient, Outcome, Side
import time

# Initialize client (API credentials auto-generated on first run)
client = TurbineClient(
    host="https://api.turbinefi.com",
    chain_id=137,  # Polygon mainnet
    private_key="0x...",  # Your wallet private key
)

# Get the latest BTC quick market
market = client.get_quick_market("BTC")
print(f"Market: {market.question}")
print(f"Strike: ${market.start_price / 1e6:.2f}")

# Place a limit buy order for YES at 50%
order = client.create_limit_buy(
    market_id=market.market_id,
    outcome=Outcome.YES,
    price=500000,      # 50% (scaled by 1e6)
    size=1_000_000,    # 1 share (6 decimals)
)

result = client.post_order(order)
print(f"Order submitted: {result['orderHash']}")

# Check the orderbook
orderbook = client.get_orderbook(market.market_id)
print(f"Best bid: {orderbook.bids[0].price / 10000:.2f}%")
print(f"Best ask: {orderbook.asks[0].price / 10000:.2f}%")

# Cancel the order
client.cancel_order(
    order_hash=result['orderHash'],
    market_id=market.market_id,
    side=Side.BUY,
)

print("Order canceled")
client.close()
On first run, you’ll see a message about registering API credentials. This is automatic and only happens once.

Understanding prices and sizes

# Prices are scaled by 1,000,000 (1e6)
# Range: 1 to 999,999

500000  # 50% (even odds)
250000  # 25%
750000  # 75%
990000  # 99%

Minimum order size

Taker orders (orders that fill immediately) must have a total value of at least $1 USDC:
# Minimum check: size × price ≥ $1 USDC
size = 1_000_000  # 1 share
price = 500000    # 50%
total = (size / 1e6) * (price / 1e6)  # = $0.50 (REJECTED)
Maker orders (resting orders that provide liquidity) have no minimum.

Read-only access

You can fetch market data without authentication:
from turbine_client import TurbineClient

# Public client (no credentials needed)
client = TurbineClient(
    host="https://api.turbinefi.com",
    chain_id=137,
)

# Get all markets
markets = client.get_markets()

# Get orderbook
orderbook = client.get_orderbook(market_id="0x...")

# Get recent trades
trades = client.get_trades(market_id="0x...")

Next steps

Installation

Detailed installation options and troubleshooting

API Reference

Complete API documentation

Build a trading bot

Learn how to build automated trading strategies

WebSocket streaming

Subscribe to real-time market updates

Build docs developers (and LLMs) love