Skip to main content

Documentation Index

Fetch the complete documentation index at: https://scalarfield.io/docs/llms.txt

Use this file to discover all available pages before exploring further.

Python functions: screenPolymarkets(), getPolymarketOHLCV(), getPolymarketTrades(), screenPolymarketWallets(), getPolymarketPositions(), getPolymarketProfile()
SpecificationValue
Delivery Frequencycontinuous, real-time
Data Frequencyevent-driven (trades), bar-aggregated (OHLCV)
CoverageAll active and resolved Polymarket prediction markets
OHLCV Timeframesdaily, hourly, 5-min, 15-min, 30-min
AvailabilityFree

Product Overview

Overview

Polymarket Data provides comprehensive access to Polymarket’s on-chain prediction market exchange. The dataset spans six functions covering market discovery, price history, trade-level data, wallet analytics, position tracking, and trader profiles. Prediction markets on Polymarket are binary or multi-outcome events (e.g. “Will X happen?”) where outcome tokens trade between 0.00and0.00 and 1.00. Each market has one or more outcome tokens identified by token_id, which you obtain from screenPolymarkets() and use across all other functions.

Functions at a Glance

FunctionPurpose
screenPolymarkets()Search and filter markets by keyword, tags, volume, status
getPolymarketOHLCV()OHLCV price bars for outcome tokens (daily to 5-min)
getPolymarketTrades()Trade-level history with wallet, price, size, USDC value
screenPolymarketWallets()Wallet leaderboards by PnL or volume, filterable by category
getPolymarketPositions()Open and closed positions for a wallet or all holders of a market
getPolymarketProfile()Trader profile: name, bio, portfolio value, markets traded

Data Pipeline

Scalar Field ingests Polymarket data through three complementary paths:
  • Events & Markets: Polled from the Polymarket Gamma API every ~1 minute. Market metadata (questions, outcomes, prices, volume, status) stays current within seconds of changes on Polymarket.
  • On-chain Trades: Indexed directly from Polymarket’s exchange contracts on Polygon, with ~2-second polling. Each trade is enriched with market and event metadata before storage.
  • OHLCV Bars: Aggregated from on-chain trades at 5-minute, hourly, and daily granularity. 15-minute and 30-minute bars are derived from 5-minute bars at query time.
  • Wallet, Position & Profile data: Proxied live from the Polymarket API — each query fetches current data directly, with no local caching delay.

Coverage

  • Markets: All active and resolved Polymarket prediction markets, continuously synced.
  • Trades: On-chain trade history from Polymarket’s V2 exchange contracts on Polygon, plus earlier indexed trades.
  • Categories: sports, politics, crypto, culture, weather, economics, tech, finance.
  • OHLCV Timeframes: daily, hourly, 30-min, 15-min, 5-min.

Querying the Data

screenPolymarkets()

Search and filter prediction markets. Returns market metadata, current prices, volume, token IDs, and resolution status.
from scalarlib import screenPolymarkets

# Browse top markets by volume
df = screenPolymarkets()

# Search for bitcoin-related markets
df = screenPolymarkets(query="bitcoin")

# Open sports markets with minimum volume
df = screenPolymarkets(event_tags='sports', closed=False, min_volume=10000)

# Get token_ids for use in other functions
df = screenPolymarkets(query="super bowl", closed=False)
token_ids = df.iloc[0]['token_ids']

# Bulk lookup of specific markets by ID
df = screenPolymarkets(market_ids=['1476588', '1519231', '1518255'], closed=True)

Parameters

ParameterTypeRequiredDescription
querystrNoSearch string (e.g. "trump election", "bitcoin price").
market_idslist of strNoSpecific market IDs for bulk lookup (faster than filtering).
event_tagsstr or listNoFilter by tag(s), OR logic. Options: 'sports', 'politics', 'crypto', 'culture', etc.
exclude_event_tagsstr or listNoExclude markets with these tags.
closedboolNoFalse = open markets, True = resolved markets.
min_volumefloatNoMinimum USD volume. Defaults to 1,000 when query is provided.
start_datestrNo"YYYY-MM-DD". Filter on market lifecycle: market_start_date >= start_date.
end_datestrNo"YYYY-MM-DD". Filter on market lifecycle: market_end_date <= end_date.
sort_bystrNo"volume" (default) or "created_at".
limitintNoMaximum results (default 50).
offsetintNoPagination offset (default 0).

Return Schema

ColumnTypeDescription
market_idstringUnique market identifier
market_questionstringThe market’s question (e.g. “Will X happen?”)
market_slugstringURL-friendly market slug
market_volumefloatTotal traded volume (USD)
market_closedboolWhether the market has resolved
market_outcomeslistOutcome labels (e.g. ['Yes', 'No'])
market_outcome_priceslistCurrent prices for each outcome (0 to 1)
market_best_bidfloatBest bid price
market_best_askfloatBest ask price
market_last_trade_pricefloatLast trade price
market_start_datedatetimeMarket start date
market_end_datedatetimeMarket end/resolution date
market_created_atdatetimeMarket creation timestamp
event_idstringParent event identifier
event_titlestringParent event title
event_slugstringParent event slug
token_idslist of strOutcome token IDs — use these with all other Polymarket functions
winning_outcome_indexint or NoneIndex of the winning outcome (None if unresolved)

getPolymarketOHLCV()

OHLCV price bars for prediction market outcome tokens. Supports daily, hourly, and sub-hourly timeframes. Omit start and end for live mode (latest bar).
from scalarlib import getPolymarketOHLCV

# Daily bars
data = getPolymarketOHLCV(token_ids=['abc123...'], start='2026-01-01', end='2026-02-01')
df = data['abc123...']

# Hourly bars (inferred from datetime format)
data = getPolymarketOHLCV(token_ids=['abc123...'], start='2026-02-01T09:00:00', end='2026-02-01T18:00:00')

# 5-minute bars with explicit timeframe
data = getPolymarketOHLCV(token_ids=['abc123...'], start='2026-02-01', end='2026-02-02', timeframe='5min')

# Live mode — latest bar
data = getPolymarketOHLCV(token_ids=['abc123...', 'def456...'])

Parameters

ParameterTypeRequiredDescription
token_idslist of strYesOutcome token IDs from screenPolymarkets().
startstrNo"YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS" (New York time). Omit for live mode.
endstrNoSame format as start. Omit for live mode.
timeframestrNo"day", "hour", "5min", "15min", or "30min". If omitted, inferred from date format (date-only = daily, datetime = hourly).

Return Schema

Returns Dict[str, pd.DataFrame] keyed by token ID. Each DataFrame:
ColumnTypeDescription
ts_recvdatetime64[ns, US/Eastern]Bar timestamp (New York time)
tickerstringToken identifier
openfloatOpening price (0–1)
highfloatHigh price
lowfloatLow price
closefloatClosing price
volumefloatTrading volume

getPolymarketTrades()

Trade-level history for prediction markets. Filter by token, wallet, market, event, side, size, price, or USDC value. At least one filter parameter is required.
from scalarlib import getPolymarketTrades

# Recent trades on specific tokens
df = getPolymarketTrades(token_ids=['abc...'], start='2026-02-01')

# Wallet trade history
df = getPolymarketTrades(wallets=['0x1234...'], start='2026-01-01')

# Whale trades (> $50k)
df = getPolymarketTrades(min_usdc_value=50000, start='2026-02-01', sort_by='usdc_value')

# Buy-side only, sorted by size
df = getPolymarketTrades(market_ids=['1356546'], side='BUY', start='2026-02-01', sort_by='size')

Parameters

ParameterTypeRequiredDescription
token_idslist of strNoFilter by outcome token IDs.
walletslist of strNoFilter by wallet addresses (0x-prefixed).
market_idslist of strNoFilter by market IDs.
event_idslist of strNoFilter by event IDs.
sidestrNo"BUY" or "SELL".
min_sizefloatNoMinimum trade size in shares.
max_sizefloatNoMaximum trade size in shares.
min_usdc_valuefloatNoMinimum USDC value.
max_usdc_valuefloatNoMaximum USDC value.
min_pricefloatNoMinimum price (0–1).
max_pricefloatNoMaximum price (0–1).
startstrNo"YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS" (New York time). Recommended for performance.
endstrNoSame format as start.
include_market_infoboolNoEnrich with market question, outcomes, event title (default True).
sort_bystrNo"timestamp" (default), "size", "usdc_value", or "price".
ascendingboolNoFalse = newest/largest first (default).
limitintNoMaximum results (default 1,000).
offsetintNoPagination offset (default 0).

Return Schema

Base columns (always present):
ColumnTypeDescription
ts_recvdatetime64[ns, US/Eastern]Trade timestamp (New York time)
timestampintUnix timestamp
walletstringTrader wallet address
sidestring"BUY" or "SELL"
pricefloatExecution price (0–1)
sizefloatNumber of shares traded
usdc_valuefloatTrade value in USDC
outcome_token_idstringOutcome token traded
outcome_indexintOutcome index (0 or 1)
market_idstringMarket identifier
event_idstringEvent identifier
Additional columns (when include_market_info=True, the default):
ColumnTypeDescription
market_questionstringMarket question text
market_outcomeslistOutcome labels
market_volumefloatTotal market volume
market_closedboolWhether market has resolved
traded_outcomestringName of the traded outcome
event_titlestringParent event title
event_urlstringPolymarket event URL

screenPolymarketWallets()

Wallet leaderboards by PnL or volume, filterable by prediction market category and time period.
from scalarlib import screenPolymarketWallets

# Top 10 wallets by PnL
df = screenPolymarketWallets(limit=10)

# Most active sports traders this week
df = screenPolymarketWallets(category='sports', time_period='week', sort_by='volume')

# Crypto wallets with > $100k PnL this month
df = screenPolymarketWallets(category='crypto', time_period='month', min_value=100000)

# PnL leaderboard in a range
df = screenPolymarketWallets(min_value=10000, max_value=50000)

Parameters

ParameterTypeRequiredDescription
categorystrNo"overall" (default), "sports", "crypto", "politics", "culture", "weather", "economics", "tech", "finance".
time_periodstrNo"all" (default), "month", "week", "day".
sort_bystrNo"pnl" (default) or "volume".
min_valuefloatNoMinimum PnL or volume threshold (depends on sort_by).
max_valuefloatNoMaximum PnL or volume threshold.
limitintNoMaximum results (default 50).
offsetintNoPagination offset (default 0).

Return Schema

ColumnTypeDescription
rankintLeaderboard rank
walletstringWallet address
pnlfloatProfit and loss (USD)
volumefloatTotal trading volume (USD)
usernamestringPolymarket username
profile_imagestringProfile image URL
verifiedboolWhether the wallet is verified
x_usernamestringX (Twitter) username

getPolymarketPositions()

Open and closed positions for a wallet in prediction markets, or all holders of a specific market. At least one of wallet or token_id is required.
from scalarlib import getPolymarketPositions

# Wallet's open positions
df = getPolymarketPositions(wallet='0x6a72...')

# Wallet's closed (resolved) positions
df = getPolymarketPositions(wallet='0x6a72...', status='closed', sort_by='realized_pnl')

# All holders of a market
df = getPolymarketPositions(token_id='7546712961...')

# Biggest holders by size
df = getPolymarketPositions(token_id='7546712961...', sort_by='size')

# A specific wallet's position in a market
df = getPolymarketPositions(wallet='0x6a72...', token_id='7546712961...')

# Who exited a market?
df = getPolymarketPositions(token_id='7546712961...', status='closed', sort_by='realized_pnl')

Parameters

ParameterTypeRequiredDescription
walletstrNo*Wallet address, 0x-prefixed. *At least one of wallet or token_id required.
token_idstrNo*Outcome token ID from screenPolymarkets(). *At least one of wallet or token_id required.
event_idintNoFilter by event ID.
statusstrNo"open" (default), "closed", or "all".
sort_bystrNo"size" (default), "pnl", "percent_pnl", "realized_pnl", "price", "avg_price", "total_pnl".
ascendingboolNoFalse = largest first (default).
limitintNoMaximum results (default 100).
offsetintNoPagination offset (default 0).

Return Schema

Columns vary depending on the query: By wallet (open positions):
ColumnTypeDescription
walletstringWallet address
assetstringToken identifier
condition_idstringMarket condition ID
sizefloatPosition size (shares)
avg_pricefloatAverage entry price
initial_valuefloatCost basis
current_valuefloatCurrent market value
cash_pnlfloatUnrealized P&L
percent_pnlfloatP&L percentage
realized_pnlfloatRealized P&L
cur_pricefloatCurrent price
titlestringMarket question
outcomestringOutcome name (e.g. “Yes”)
outcome_indexintOutcome index
event_slugstringEvent URL slug
end_datedatetimeMarket end date
By wallet (closed positions):
ColumnTypeDescription
walletstringWallet address
assetstringToken identifier
condition_idstringMarket condition ID
avg_pricefloatAverage entry price
total_boughtfloatTotal shares purchased
realized_pnlfloatRealized P&L
cur_pricefloatSettlement price
titlestringMarket question
outcomestringOutcome name
outcome_indexintOutcome index
event_slugstringEvent URL slug
By token_id (all holders):
ColumnTypeDescription
walletstringHolder wallet address
namestringPolymarket username
profile_imagestringProfile image URL
verifiedboolWhether verified
assetstringToken identifier
avg_pricefloatAverage entry price
sizefloatPosition size
cur_pricefloatCurrent price
current_valuefloatCurrent market value
cash_pnlfloatUnrealized P&L
realized_pnlfloatRealized P&L
total_pnlfloatTotal P&L (unrealized + realized)
outcomestringOutcome name
outcome_indexintOutcome index

getPolymarketProfile()

Trader profile information for a Polymarket wallet.
from scalarlib import getPolymarketProfile

df = getPolymarketProfile(wallet='0x6a72...')
print(df.iloc[0]['portfolio_value'])
print(df.iloc[0]['name'], df.iloc[0]['verified'])

Parameters

ParameterTypeRequiredDescription
walletstrYesWallet address, 0x-prefixed.

Return Schema

Returns a single-row DataFrame:
ColumnTypeDescription
walletstringWallet address
namestringDisplay name
pseudonymstringPseudonym
biostringProfile bio
profile_imagestringProfile image URL
verifiedboolWhether the account is verified
x_usernamestringX (Twitter) username
created_atdatetimeAccount creation date (New York time)
portfolio_valuefloatTotal portfolio value (USD)
markets_tradedintNumber of markets traded