Documentation Index
Fetch the complete documentation index at: https://docs.codex.io/llms.txt
Use this file to discover all available pages before exploring further.
Prediction market traders have rich on-chain performance data: win rate, P&L, volume, position sizing, and per-market breakdowns. This recipe covers 5 queries that work together: discover traders → view profile → see positions → chart performance → trade history.
Step 1: Trader Leaderboard
filterPredictionTraders.Top all-time profitable traders
Top all-time profitable traders
Best win rate this week (minimum volume filter)
Best win rate this week (minimum volume filter)
Highest 24h PnL
Highest 24h PnL
Search for a trader
Search for a trader
totalVolumeUsdAll: { gte: 10000 }) are essential for meaningful leaderboards. Filter out low-activity traders.P&L per volume (pnlPerVolumeAll) normalizes profit by capital deployed, making it better for comparing traders of different sizes.Search matches against alias, primary address, or venue trader ID.Step 2: Trader Profile & Detailed Stats
detailedPredictionTraderStats.Full trader profile with windowed stats
Full trader profile with windowed stats
- The
traderobject has the all-time aggregate profile: total volume, profit, biggest win/loss, trade count, active markets - Windowed stats (
statsHour1throughstatsDay30) give recent performance breakdowns statsCurrencyhas all the monetary metrics,statsNonCurrencyhas counts,statsChangehas period-over-period changesheldTokenAcquisitionCostUsd/soldTokenAcquisitionCostUsdshow the cost basis of currently held and already-sold positionsrealizedProfitPercentageis the return on capital for the window- Use the windowed stats to build a time-period toggle (1h, 4h, 12h, 24h, 1w, 30d) on the trader profile
Step 3: Trader’s Market Positions
filterPredictionTraderMarkets.filterPredictionMarkets, filterPredictionEvents, or filterPredictionTraders queries to find relevant IDs.Open positions sorted by P&L
Open positions sorted by P&L
Top traders for a specific market
Top traders for a specific market
Top traders in a specific event
Top traders in a specific event
outcome0 and outcome1 with shares held, avg entry price, cost basis, realized P&L.hasOpenPosition: Filter to show only active positions vs historical ones.pnlStatus: Indicates the P&L state for the outcome (e.g., PROFIT, LOSS).avgEntryPriceCT: The average price the trader paid. Compare with current market price to estimate unrealized P&L.Cross-referencing: Use marketIds to find top traders for a market, or eventIds for an event. This powers “Top Traders” tabs on market/event pages.predictionTraderMarketsStats as a simpler alternative for fetching a trader’s per-market stats without the filtering/ranking system:Simple position list with predictionTraderMarketsStats
Simple position list with predictionTraderMarketsStats
Step 4: Trader Performance Charts
predictionTraderBars.Trader performance bars
Trader performance bars
- Plot
cumulativeRealizedPnlCTover time. This is the signature trader performance chart - Shows the running total of realized profit/loss
- Color the line green when positive, red when negative
realizedPnlUsdper bar. Green bars for profit, red for loss- Pair with the cumulative line above for a combo chart
volumeUsdor split intobuyVolumeUsd/sellVolumeUsd
winsandlossesper bar. Stacked or grouped bars showing resolution outcomes
trades,buys,sells: trade frequencyuniqueMarkets: how diversified the trader is per period
Step 5: Trader’s Trade History
predictionTrades.Trader trade history
Trader trade history
- Returns individual trades with full context: market, outcome, price, size, direction
tradeTypeindicates BUY or SELLoutcomeLabelshows which outcome was traded (e.g., “Yes” or “No”)priceCollateralis the price paid per shareamountis the number of shares,amountUsdis the USD valuecursorenables pagination for loading more trades- Include
predictionMarketto show market context alongside each trade
Putting It All Together
Here’s the recommended data flow: For a trader profile page, on page load (parallel queries):detailedPredictionTraderStats: profile header, summary stats, windowed performancefilterPredictionTraderMarkets(traderIds, hasOpenPosition: true): active positions tablepredictionTraderBars: cumulative P&L chart
filterPredictionTraderMarkets(traderIds): all positions (when user switches to “All Positions” tab)predictionTrades(traderId): trade history (when user switches to “Trades” tab)
filterPredictionTraders: the main ranked list with configurable sort- Click a trader → navigate to their profile using the data flow above