Welcome Hackathon Participants!
This guide helps you quickly get started building prediction market agents. Whether you’re at a hackathon or just want a fast path to creating your first agent, this is your starting point.What Are Prediction Markets?
Prediction markets allow people to trade on the outcome of future events. Participants buy and sell shares representing different outcomes, and prices reflect the crowd’s probability estimates. Learn more: What are Prediction Markets?Quick Setup
Install Dependencies
Configure Environment
.env.example to .env and add your API keys:Get API Keys
Required API Keys
GRAPH_API_KEY - Required
GRAPH_API_KEY - Required
- Create account at The Graph
- Navigate to API Keys section
- Create new API key
- Add to
.env:GRAPH_API_KEY=your_key_here
SERPER_API_KEY - Required
SERPER_API_KEY - Required
- Sign up at Serper.dev
- Copy your API key from dashboard
- Add to
.env:SERPER_API_KEY=your_key_here
FIRECRAWL_API_KEY - Required
FIRECRAWL_API_KEY - Required
- Create account at Firecrawl
- Get API key from dashboard
- Add to
.env:FIRECRAWL_API_KEY=your_key_here
OPENAI_API_KEY - Required
OPENAI_API_KEY - Required
- For hackathon: Join Discord and ask organizers
- Otherwise: https://platform.openai.com
.env: OPENAI_API_KEY=sk-...BET_FROM_PRIVATE_KEY - Required
BET_FROM_PRIVATE_KEY - Required
- Install MetaMask
- Create new wallet or use existing
- Add Gnosis Chain network to MetaMask:
- Click network selector (top left)
- Click “Add a custom network”
- Enter details:
- Name: Gnosis Chain
- RPC URL: https://rpc.gnosischain.com
- Chain ID: 100
- Symbol: XDAI
- Export private key from MetaMask:
- Click account menu
- Account details > Export private key
- Get xDai funds:
- For hackathon: Ask organizers in Discord
- Otherwise: Bridge from Ethereum mainnet
- Add to
.env:BET_FROM_PRIVATE_KEY=0x...
MANIFOLD_API_KEY - For Benchmarking
MANIFOLD_API_KEY - For Benchmarking
- Create account at Manifold
- Go to Settings > API
- Generate new API key
- Add to
.env:MANIFOLD_API_KEY=your_key_here
Running Your First Agent
Once configured, run an existing agent to test your setup:The Task
Goal: Implement new logic for trading on prediction markets that gets good predictions for cheap. Success Criteria:- Accuracy >50% (better than random)
- Cost-effective (considering API costs, LLM calls, etc.)
- Bonus points for creativity and novel approaches!
Recommended Steps
Study the Simplest Agent
prediction_market_agent/agents/coinflip_agent/deploy.py - this is the simplest possible agent:Study the Advanced Agent
prediction_market_agent/agents/advanced_agent/deploy.py - this agent actually retrieves information from the web:Key features:- Searches Google for relevant information
- Scrapes content from top URLs
- Uses LLM to analyze and predict
Study a Top Performer
- 60% success rate
- $834.73 in profits
- Top of the leaderboard
- Test in Streamlit demo
- See predictions and reasoning in real-time
- Analyze on Dune Dashboard
Create Your Agent
- Change LLM prompts
- Add more data sources (Twitter, news APIs, etc.)
- Implement specialized logic for certain market types
- Use different models (Claude, Gemini, etc.)
- Add caching to reduce costs
- Implement multi-step reasoning
Example: Modifying the Advanced Agent
Here’s how to create your own agent based on AdvancedAgent:Evaluation Methods
1. Run Benchmark (Fast)
Test against resolved Manifold markets:2. Live Trading (Real evaluation)
Setbet_on_n_markets_per_run and run daily:
3. Manual Observation
Use the Streamlit app for interactive testing:Need More API Keys?
If you want to use a 3rd party service that requires paid API keys, reach out to hackathon organizers in the Discord channel!Running Multiple Agents
You can run multiple agents simultaneously to test different theories:Create Separate Repos
Separate Private Keys
- Create multiple MetaMask accounts
- Use different private keys in each
.envfile
Deploy Each Agent
Ideas to Explore
Better Prompts
More Data Sources
Specialized Agents
Multi-Model Ensemble
Historical Analysis
Cost Optimization
Chain-of-Thought
Market Timing
Production Deployment
If your agent achieves at least 50% accuracy, it may be added to production deployment! Benefits:- Your agent runs live at Presagio
- Appears on the leaderboard
- Tracked on Dune Dashboard
- Trades on real markets 24/7
-
50% accuracy (proxy for not losing money)
- Your approval to use the agent
- Clean, maintainable code
Resources
GitHub Repository
Discord Community
Presagio Leaderboard
Dune Dashboard
Streamlit Demo
Tips for Success
Start Simple
Start Simple
Focus on Evidence
Focus on Evidence
Manage Costs
Manage Costs
Iterate Quickly
Iterate Quickly
Read the Code
Read the Code
Ask for Help
Ask for Help
Common Issues
ModuleNotFoundError
ModuleNotFoundError
API Key Errors
API Key Errors
.env file:- Ensure all required keys are present
- No spaces around
=signs - Keys are valid and have credits
No Markets Found
No Markets Found
- Check GRAPH_API_KEY is valid
- Verify network connectivity
- Try different market type (manifold, omen)
Transaction Failures
Transaction Failures
- Ensure wallet has xDai balance
- Check private key is correct format (starts with 0x)
- Verify you’re on Gnosis Chain (chain ID 100)