Start Here
If you’re new to Turbine or building your first trading bot, start with the Price Action Bot. It’s the canonical reference implementation that demonstrates every aspect of the bot lifecycle.Price Action Bot
787 lines — The complete reference implementation. Fetches live BTC price from Pyth Network, compares to strike, buys YES or NO. Handles credentials, USDC approval, trading, market rotation, and claiming. Read this first.
Trading Bots
Full production-ready bots that run 24/7, automatically switching markets and claiming winnings.Price Action Bot
Recommended for beginners
Trades based on live oracle price vs strike. Simple, effective, and aligned with how markets resolve.
Trades based on live oracle price vs strike. Simple, effective, and aligned with how markets resolve.
Market Maker Bot
Advanced strategy
Statistical probability-based market making with momentum tracking, inventory management, and circuit breakers.
Statistical probability-based market making with momentum tracking, inventory management, and circuit breakers.
Which Bot Should I Build?
| Your Goal | Recommended Bot | Why |
|---|---|---|
| Learn the basics | Price Action | Simple logic, demonstrates all infrastructure patterns |
| Win competitions | Price Action or Market Maker | Both proven strategies with different risk profiles |
| Provide liquidity | Market Maker | Posts resting orders on both sides of the book |
| Build custom strategy | Start from Price Action | Use it as a template, replace the signal logic |
SDK Usage Snippets
Small, focused scripts demonstrating individual SDK features. Good for understanding the API surface without the complexity of a full bot.Basic Usage
Read-only API calls
Fetch markets, orderbook, trades. No auth required. Start here to explore data.View source
Fetch markets, orderbook, trades. No auth required. Start here to explore data.View source
Create Order
EIP-712 signing
Create signed orders using helper functions. Shows price/size conversion.View source
Create signed orders using helper functions. Shows price/size conversion.View source
Submit Order
Full order workflow
Create, submit, retrieve, and cancel orders. Demonstrates authenticated trading.View source
Create, submit, retrieve, and cancel orders. Demonstrates authenticated trading.View source
WebSocket Stream
Real-time data
Subscribe to orderbook updates, trades, and market rotations via WebSocket.View source
Subscribe to orderbook updates, trades, and market rotations via WebSocket.View source
Utilities
One-off scripts for managing positions and claiming winnings outside of a bot.Position Monitoring
Track your positions
Fetch current positions and calculate P&L across all markets.
Fetch current positions and calculate P&L across all markets.
Claim Winnings
Manual claiming
Claim winnings from a single resolved market via the gasless relayer.View source
Claim winnings from a single resolved market via the gasless relayer.View source
Batch Claim
Bulk operations
Claim winnings from multiple resolved markets in one batch transaction.View source
Claim winnings from multiple resolved markets in one batch transaction.View source
Testing & Stress
Load testing and integration tests. Not relevant for building a trading bot — skip these unless you’re testing the API itself.View testing scripts
View testing scripts
| File | Purpose |
|---|---|
stress_test_bot.py | Places N trades simultaneously to test API concurrency |
setup_stress_test_accounts.py | Generates test accounts and funds them with testnet USDC |
test_order_integration.py | Integration test for API credential registration |
full_order_lifecycle.py | End-to-end test: place → cancel → fill → sell |
Next Steps
Read the canonical reference
Start with the Price Action Bot walkthrough to understand the complete bot structure.
Understand the strategy
Learn why it works: the Price Action strategy trades based on the same oracle (Pyth Network) that Turbine uses to resolve markets.
Key Infrastructure Patterns
Every working bot must implement these patterns. Do not remove or alter them when building your own bot:1. Order Verification Chain
After submitting an order, wait 2 seconds, then check in sequence:- Failed trades — did it get rejected?
- Pending trades — is it processing on-chain?
- Recent trades — did it fill immediately?
- Open orders — is it resting on the book?
2. Gasless USDC Approval
One-time gasless permit per settlement contract. Check allowance first via API, skip if already approved.approve_usdc() returns a dict with tx_hash (not a raw string).
3. Market Rotation
Poll for new markets every 5 seconds. When a new market appears:- Cancel all orders on the old market
- Reset state variables
- Start trading the new market
4. Claiming Winnings
Background task that checks for resolved markets and claims via the gasless relayer. Enforce a 15-second delay between claims (API rate limit).5. Market Expiration
Stop placing new orders when less than 60 seconds remain. Themarket_expiring flag prevents the bot from getting stuck with orders on an expired market.
These patterns exist in both the Price Action and Market Maker bots. Study how they’re implemented, then preserve them in your own strategies.
Common Questions
Can I modify the example bots?
Can I modify the example bots?
Yes! The examples are templates. The core creative decision is the trading signal — everything else (market management, USDC approval, order submission, position tracking, claiming) follows the same pattern across all bots.To build a custom strategy:
- Copy
price_action_bot.pyas a starting point - Replace the
calculate_signal()function with your logic - Keep all infrastructure patterns intact
Why start with Price Action instead of Market Maker?
Why start with Price Action instead of Market Maker?
Price Action is simpler and more intuitive:
- Single signal: Buy YES if price > strike, NO if price < strike
- Directional: Takes a position based on market direction
- Oracle-aligned: Uses the same Pyth feed that resolves markets
- Statistical model: Normal CDF probability calculation with time decay
- Inventory management: Tracks net exposure and adjusts quotes
- Circuit breakers: Adverse selection detection
- Multi-level quoting: Geometric size distribution across price levels
How much USDC do I need?
How much USDC do I need?
Depends on your bot’s order size and max position:
- Price Action default: 10 max position = ~$10 minimum
- Market Maker default: 60 minimum**
- Testing: Start with $10-20 to learn without risk
- Competition: Top bots typically run $100-500+ in capital
Can I run multiple bots from the same wallet?
Can I run multiple bots from the same wallet?
No. Each bot needs its own wallet (private key). Running multiple bots from the same wallet will cause race conditions, double-spends, and nonce conflicts.For the weekly competition, you can register multiple bots (each with its own wallet) under the same account.