API VERSION
v1.0
ENDPOINTS
15+
STATUS
ONLINE

[ API DOC ]

RESTful API for prediction markets. Create markets, place bets, trade on order books, and access real-time pricing data. Kalshi-compatible endpoints included.

⚡ QUICK START

Get started with the EVENT TRADER API in seconds. Generate a free API key below and start making requests.

🔑 GENERATE FREE API KEY

# Example: Fetch all active markets curl -H "X-API-Key: your-api-key-here" \ http://localhost:8000/api/v1/markets?status=active # Example: Place a trade curl -X POST http://localhost:8000/api/v1/markets/{contract}/bets \ -H "X-API-Key: your-api-key-here" \ -H "Content-Type: application/json" \ -d '{"user_id": "your_id", "asset": "BTC", "amount": 100}'
REST
API TYPE
JSON
DATA FORMAT
HTTPS
PROTOCOL

[ KEY FEATURES ]

🎯 PREDICTION MARKETS

Create and manage prediction markets for crypto, stocks, and custom events. Full CRUD operations supported.

💰 ORDER BOOK TRADING

Place limit orders, view order books, and execute trades on a fully functional order matching engine.

📊 REAL-TIME PRICING

Access live price feeds for cryptocurrencies and stocks. Automatic price updates and historical data.

🔄 KALSHI COMPATIBLE

API endpoints follow Kalshi's patterns including cursor-based pagination and query parameters.

⚡ HIGH PERFORMANCE

Built on FastAPI with async support. Redis caching for optimal response times.

🔒 SECURE & RELIABLE

API key authentication, rate limiting, and comprehensive error handling built-in.

[ CORE ENDPOINTS ]

Markets

GET /api/v1/markets

List all prediction markets with optional filters. Supports cursor-based pagination.

// Query Parameters: limit: 100 // Results per page (1-1000) cursor: "base64_token" // Pagination cursor status: "active" // Filter: pending, active, completed asset_type: "crypto" // Filter: crypto, stock tickers: "0x123,0x456" // Comma-separated contract addresses
GET /api/v1/markets/{contract_address}

Get detailed information about a specific market.

POST /api/v1/markets

Create a new prediction market.

{ "name": "Q1 2025 Crypto Winners", "description": "Which crypto will have highest gains?", "assets": ["BTC", "ETH", "SOL"], "asset_type": "crypto", "token": "USDC", "start_time": "2025-11-20T00:00:00Z", "end_time": "2025-12-31T23:59:59Z", "min_bet": 10.0, "max_bet": 10000.0 }
GET /api/v1/markets/{contract}/results

Get current standings and results for a market including price changes and winner.

Order Book Trading

GET /api/v1/markets/{contract}/orderbook

Get order book for a specific asset. Returns bids and asks with price levels.

// Query Parameters: asset: "BTC" // Required: Asset symbol
POST /api/v1/markets/{contract}/orders

Place a limit order (buy or sell) on the order book.

{ "user_id": "user_123", "asset": "BTC", "side": "buy", "price": 0.65, "quantity": 100.0 }

Trading

POST /api/v1/markets/{contract}/bets

Place a trade on a specific asset in a market.

{ "user_id": "user_123", "asset": "BTC", "amount": 100.0 }

Pricing

GET /api/v1/prices/{asset}

Get current price for a specific asset (crypto or stock).

GET /api/v1/prices

Get bulk prices for multiple assets.

// Query Parameters: assets: "BTC" // Repeat for multiple assets assets: "ETH" assets: "SOL"

[ AUTHENTICATION ]

All API requests require an API key in the X-API-Key header.

# Include API key in all requests curl -H "X-API-Key: your-api-key-here" \ http://localhost:8000/api/v1/markets

⚠️ Default key for testing: user-secret-key

[ RESPONSE FORMAT ]

All responses are returned in JSON format with appropriate HTTP status codes.

Success Response

{ "markets": [...], "cursor": "next_page_token" }

Error Response

{ "error": { "code": "MARKET_NOT_FOUND", "message": "Market with contract address 0x123 not found" } }

[ AI TRADING AGENT ]

AI-powered cryptocurrency analysis and asset recommendations using Claude Sonnet 4.

Prompt Assets

POST /api/v1/ai_trading_agent/prompt-assets

Analyze a natural language prompt and return relevant cryptocurrency assets with probability scores.

Request Body

{ "prompt": "What are the best DeFi tokens?", "user_id": "web_user" }

Response

{ "assets": [ { "symbol": "UNI", "probability": 0.92, "explanation": "Uniswap is the leading decentralized exchange..." }, { "symbol": "AAVE", "probability": 0.90, "explanation": "Aave is a top lending protocol..." }, { "symbol": "MKR", "probability": 0.88, "explanation": "Maker is the governance token for DAI..." } ] }

cURL Example

curl -X POST "http://localhost:8000/api/v1/ai_trading_agent/prompt-assets" \ -H "Content-Type: application/json" \ -H "X-API-Key: admin-secret-key" \ -d '{ "prompt": "AI-focused cryptocurrencies", "user_id": "trader_123" }'

Features

  • Natural language understanding of trading queries
  • Probability-weighted asset recommendations (0.0-1.0)
  • Detailed explanations for each recommendation
  • Supports all 50 cryptocurrencies in the database
  • Context-aware analysis using vector database

Analyze URL Assets

POST /api/v1/ai_trading_agent/analyze-url-assets

Analyze how cryptocurrencies relate to content from any URL (news articles, blog posts, research papers).

Request Body

{ "url": "https://example.com/crypto-news-article", "assets": ["BTC", "ETH", "SOL", "LINK"] }

Response

{ "headline": "Bitcoin Surges Past $45,000", "url_summary": "Article discusses Bitcoin reaching new highs...", "content_type": "news", "overall_market_impact": "positive", "asset_analyses": [ { "symbol": "BTC", "name": "Bitcoin", "relevance_score": 1.0, "relationship": "Direct Impact", "impact_direction": "positive", "confidence": "high", "analysis": "Bitcoin is the primary subject...", "key_points": [ "Price milestone achievement at $45,000", "Institutional adoption driving momentum", "Technical breakout confirmed" ] }, { "symbol": "ETH", "name": "Ethereum", "relevance_score": 0.6, "relationship": "Sector Correlation", "impact_direction": "positive", "confidence": "medium", "analysis": "Ethereum typically follows Bitcoin...", "key_points": [ "Strong correlation with Bitcoin movements", "Positive market sentiment spillover" ] } ], "url": "https://example.com/crypto-news-article" }

Relevance Scoring

  • 0.9-1.0: Direct subject of content
  • 0.7-0.89: Strong correlation
  • 0.5-0.69: Moderate connection
  • 0.3-0.49: Weak correlation
  • 0.0-0.29: Minimal connection

Relationship Types

  • Direct Impact
  • Competitive Pressure
  • Sector Correlation
  • Technology Alignment
  • Market Sentiment
  • Regulatory Impact
  • Ecosystem Integration
  • Use Case Overlap

cURL Example

curl -X POST "http://localhost:8000/api/v1/ai_trading_agent/analyze-url-assets" \ -H "Content-Type: application/json" \ -H "X-API-Key: admin-secret-key" \ -d '{ "url": "https://en.wikipedia.org/wiki/Ethereum", "assets": ["ETH", "BTC", "SOL"] }'

Use Cases

  • News Analysis: Understand how breaking news affects different cryptos
  • Research: Analyze whitepapers and technical documentation
  • Market Intelligence: Compare competitive positioning from articles
  • Risk Assessment: Identify regulatory and competitive risks
  • Investment Decisions: Evidence-based asset selection

Powered By

Claude Sonnet 4 AI with advanced cryptocurrency market knowledge and analysis capabilities.

[ TECHNICAL INDICATORS ]

Advanced technical analysis indicators for cryptocurrency price movements.

MACD Indicator

GET /api/v1/technical_indicators/macd/{symbol}

Calculate MACD (Moving Average Convergence Divergence) technical indicator with customizable parameters.

Path Parameters

symbol: Cryptocurrency symbol (e.g., BTC, ETH, SOL)

Query Parameters

days: Number of historical days (default: 90, min: 35, max: 365) fast_period: Fast EMA period (default: 12) slow_period: Slow EMA period (default: 26) signal_period: Signal line period (default: 9)

Response

{ "symbol": "BTC", "current": { "macd": 234.56, "signal": 198.32, "histogram": 36.24, "trend": "bullish" }, "interpretation": { "signal": "BUY", "strength": "strong", "description": "MACD crossed above signal line - bullish momentum" }, "metadata": { "current_price": 43250.00, "start_date": "2024-08-20", "end_date": "2024-11-20", "data_points": 90 }, "timeseries": [ { "date": "2024-11-20", "macd": 234.56, "signal": 198.32, "histogram": 36.24 } ] }

MACD Components

  • MACD Line: Fast EMA (12-day) - Slow EMA (26-day)
  • Signal Line: 9-day EMA of the MACD line
  • Histogram: MACD line - Signal line

Interpretation

  • Bullish Signal: MACD crosses above signal line (positive histogram)
  • Bearish Signal: MACD crosses below signal line (negative histogram)
  • Trend Strength: Larger histogram values = stronger momentum

cURL Example

curl "http://localhost:8000/api/v1/technical_indicators/macd/BTC?days=90" \ -H "X-API-Key: admin-secret-key"

Advanced Usage

# Custom MACD parameters curl "http://localhost:8000/api/v1/technical_indicators/macd/ETH?days=180&fast_period=8&slow_period=21&signal_period=5" \ -H "X-API-Key: admin-secret-key"

[ WEBSOCKET API ]

Real-time streaming data via WebSocket connections for live market updates.

Market WebSocket

WS /ws/market/{contract_address}

Connect to receive real-time updates for a specific market including orderbook changes, trades, and price updates.

Subscribe to Channel

{ "action": "subscribe", "channel": "orderbook", "asset": "BTC" }

Message Types

// Orderbook Update { "type": "orderbook_update", "asset": "BTC", "bids": [...], "asks": [...], "best_bid": 0.64, "best_ask": 0.66, "spread": 0.02 } // Trade Execution { "type": "trade", "asset": "BTC", "price": 0.65, "quantity": 100, "side": "buy", "timestamp": "2025-01-15T10:30:00Z" } // Price Update { "type": "price_update", "asset": "BTC", "price": 45000.00, "change_24h": 2.5 }

Python Example

import asyncio import websockets import json async def connect(): uri = "ws://localhost:8000/ws/market/0x1234..." async with websockets.connect(uri) as ws: # Subscribe to orderbook await ws.send(json.dumps({ "action": "subscribe", "channel": "orderbook", "asset": "BTC" })) async for message in ws: data = json.loads(message) print(f"Received: {data['type']}")

Available Channels

  • orderbook - Real-time order book updates
  • trades - Live trade executions
  • prices - Asset price changes
  • market - Market status updates

Incentives WebSocket

WS /ws/incentives/{wallet_address}

Stream real-time updates for bot earnings, tier changes, and leaderboard positions.

Message Types

// Earnings Update { "type": "earnings_update", "bot_id": "bot_123", "new_earnings": 15.50, "total_earnings": 1250.00 } // Tier Promotion { "type": "tier_change", "bot_id": "bot_123", "old_tier": "silver", "new_tier": "gold", "new_benefits": { "fee_discount": 10, "reward_multiplier": 1.5 } }

[ INCENTIVES API ]

Bot registration, rewards tracking, staking, and leaderboards for automated traders.

Bot Management

POST /api/v2/incentives/bots/register

Register a new trading bot to start earning rewards.

{ "name": "Alpha Market Maker", "wallet_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f3E6", "strategy_type": "market_maker", "description": "High-frequency market making bot" }
GET /api/v2/incentives/bots/{bot_id}/tier

Get current tier status and progression for a bot.

// Response { "current_tier": "gold", "next_tier": "platinum", "current_volume": 75000.00, "volume_required": 100000.00, "progress_percent": 75.0, "fee_discount": 10.0, "reward_multiplier": 1.5 }

Staking

GET /api/v2/incentives/staking/pools

List all available staking pools with APY and limits.

POST /api/v2/incentives/staking/stake

Stake tokens in a pool with optional lockup period.

{ "pool_id": "pool_pred_main", "wallet": "0x742d35Cc6634C0532925a3b844Bc9e7595f3E6", "amount": 1000.0, "lockup_days": 90 }
POST /api/v2/incentives/staking/rewards/claim

Claim pending staking rewards.

GET /api/v2/incentives/staking/user/{wallet}/summary

Get staking summary for a wallet across all pools.

Leaderboards

GET /api/v2/incentives/leaderboards

Get leaderboard rankings by volume, trades, earnings, or PnL.

// Query Parameters period: "daily" | "weekly" | "monthly" | "all_time" metric: "volume" | "trades" | "earnings" | "pnl" limit: 10-100

Airdrops

GET /api/v2/incentives/airdrops

List available airdrops and eligibility status.

POST /api/v2/incentives/airdrops/{airdrop_id}/claim

Claim an airdrop allocation.

[ GAMES API ]

Gamification features including streaks, duels, tournaments, and boosts.

Trading Streaks

GET /api/v2/games/streaks/{wallet}

Get current trading streak and rewards.

Duels

POST /api/v2/games/duels

Create a 1v1 trading duel challenge.

{ "challenger_wallet": "0x...", "stake_amount": 100.0, "duration_hours": 24, "market_id": "0x1234..." }

Tournaments

GET /api/v2/games/tournaments

List active and upcoming trading tournaments.

POST /api/v2/games/tournaments/{id}/join

Join a tournament with entry fee.

Boosts

GET /api/v2/games/boosts/available

List available reward boosts and power-ups.

POST /api/v2/games/boosts/{boost_id}/activate

Activate a boost for enhanced rewards.

[ AGENT BOT ]

A standalone Python agent bot is available for automated market making and momentum trading.

# Trade all active markets python3 trading_bot.py --single-run --budget 100 # Trade specific market python3 trading_bot.py --contracts 0x123 --budget 200 # Filter by name python3 trading_bot.py --name-filter "crypto" --budget 150

The bot supports market making and momentum strategies with configurable risk parameters.

[ RESOURCES ]