What is a Trading Bot?
A trading bot is an automated program that executes trades based on predefined logic. On Turbine, bots:- Monitor the current BTC quick market (15-minute cycles)
- Analyze market conditions and generate trading signals
- Place, manage, and cancel orders automatically
- Transition to new markets when they rotate every 15 minutes
- Claim winnings from resolved markets
Bot Architecture
All Turbine bots follow a common structure. Here’s the anatomy of a well-designed trading bot:Core Components
Essential Infrastructure
Every production bot needs these critical features:1. Market Transition Handling
2. Gasless USDC Approval
3. Order Verification Chain
After submitting an order, verify its status through this sequence:4. Position Tracking
Trading Signals
The trading signal is the core creative decision in your bot. It determines when to buy YES, buy NO, or hold. Here are common strategies:Price Action Strategy
Trades based on the current BTC price vs. strike price. This is the recommended starting algorithm because it uses Pyth Network - the same oracle Turbine uses for resolution.See the complete implementation in
examples/price_action_bot.pyMomentum Strategy
Detects price direction from recent trades and follows the trend.Mean Reversion Strategy
Fades large moves, betting on reversion to average.Market Making Strategy
Provides liquidity by placing both bid and ask orders with a spread.See the complete market maker implementation in
examples/market_maker.pyComplete Bot Example
Here’s a minimal but complete trading bot:simple_bot.py
Best Practices
1. Stop Trading Before Market Expiration
2. Handle API Errors Gracefully
3. Claim Winnings Automatically
4. Log Important Events
Testing Your Bot
Before running your bot with real money:- Start with small amounts - Use
order_size=0.10andmax_position=1.0for testing - Monitor the first few cycles - Watch how it handles market transitions
- Check position tracking - Verify USDC balances match your expectations
- Test error recovery - Kill the bot and restart to ensure it resumes correctly
Next Steps
Deploy to Production
Run your bot 24/7 on Railway
WebSocket Streams
Use real-time data for faster execution
Market Data
Access orderbooks and trading history
Example Bots
Browse production-ready bot implementations