Skip to content

SDKsClients

The predictefy package is the official synchronous Python 3.10+ REST client. It uses one runtime dependency (httpx) and covers normalized venue data, history, most of the client.router REST surface, discrepancy qualification, and Trader Intelligence. The router currently omits fetch_event_matches; use REST or the TypeScript SDK for that operation. Catalog and order-book reads cover all 16 served venues, including PredictStreet; Trader Intelligence is served on a narrower native-venue set. pascal, xo, and pred are not data-only venues — each has an execution venue, in its own state, and each one does carry Trader Intelligence: all three serve wallet-attributed trades and appear in the scored-trade/smart-money feed, while holders, leaderboards, and wallet profiles stay unsupported. Actual verbs remain capability-qualified by venue.

Terminal window
pip install predictefy
from predictefy import Predictefy
client = Predictefy(api_key="pk_...")
markets = client.polymarket.fetch_markets({"limit": 5, "query": "fed"})
clusters = client.fetch_clusters({"limit": 20})
smart_money = client.fetch_smart_money({"venue": "hyperliquid", "limit": 20})

Change the venue client without changing the normalized method shape:

# Books, the tape, and candles are outcome-keyed: resolve an outcomeId from that
# venue's own catalog first. A venue-native ticker or symbol is not resolved for you.
markets = client.kalshi.fetch_markets({"limit": 1, "status": "active"})
outcome_id = markets[0]["outcomes"][0]["outcomeId"]
client.kalshi.fetch_order_book(outcome_id)
client.kalshi.fetch_ohlcv({"outcomeId": outcome_id, "resolution": "1h", "limit": 500})
client.router.fetch_markets({"query": "election", "status": "active"})
# exchange(id) is the dynamic form of the same verbs on any venue.
hyperliquid = client.exchange("hyperliquid")
hl_markets = hyperliquid.fetch_markets({"limit": 1, "status": "active"})
hyperliquid.fetch_trades(hl_markets[0]["outcomes"][0]["outcomeId"])

List methods return a PageList: an ordinary list with .page, .meta, and .next_cursor. iterate_markets follows cursors for you.

A market cursor fixes membership and order at page one, serves current row contents, and expires after a fixed time; if it expires, restart from page one. The full cursor rules are shared with the TypeScript SDK pagination section.

fetch_markets and fetch_events accept exclusive closeAfter and closeBefore bounds as strings, epoch-millisecond integers, date objects, or timezone-aware datetime objects. Dates mean UTC midnight; naive datetimes still raise ValueError before a request. Timestamp strings need Z or an explicit +HH:MM/-HH:MM offset. Extra fractional digits are truncated to milliseconds.

from datetime import date, datetime, timezone
page = client.router.fetch_events({
"closeAfter": date(2026, 10, 5),
"closeBefore": datetime(2026, 10, 7, tzinfo=timezone.utc),
})
print(page.meta["closeAfter"], page.meta["closeBefore"])

The echoes are 2026-10-05T00:00:00.000Z and 2026-10-07T00:00:00.000Z. PageList.meta carries optional closeAfter and closeBefore strings beside meta.asOf and meta.provenance. The full echo rule, including the CLOSE_BOUNDS_IGNORED refusal, is in the TypeScript SDK close-date section. The Python client applies the same check: a missing, misplaced, or mismatched echo, or an echo for a bound the request did not send, raises PredictefyError with code CLOSE_BOUNDS_IGNORED and retryable=False, and the page is never returned. Calls without bounds are unaffected.

fetch_markets and fetch_markets_paginated accept the market-only list controls below. Event lists do not accept them.

page = client.router.fetch_markets({
"ids": ["polymarket:2744695", "kalshi:KXPAYROLLS"],
"undated": "include",
"updatedAfter": "2026-10-19T00:00:00.000Z",
"sort": "updatedAt",
})
print([market.get("updatedAt") for market in page], page.meta.get("count"))

ids is one ordered list of up to 80 venue-prefixed market ids. The SDK serializes it as one comma-separated query value, not repeated keys. The response keeps the requested order, and meta["count"] reports the returned match count. Missing or hidden ids are omitted.

undated defaults to exclude, which drops markets without a stored close date when a close bound is set. include keeps them and applies the bounds to dated markets only. only returns undated markets and rejects closeAfter or closeBefore.

updatedAfter is an exclusive lower bound on the row write time. It needs an ISO timestamp with seconds, a timezone, and at most six fractional digits. sort: "updatedAt" walks row write time ascending, then market ID ascending, and requires lexical search. UnifiedMarket["updatedAt"] is the row write time as an RFC 3339 string.

Event records from fetch_events and fetch_events_paginated add venueVolume24h: the venue-stated parent 24-hour volume in native units, or None without a validated stored fact. It is never derived from member volumes; volume24h keeps its filtered member sum. Gemini events state one total only, so their member markets serve null volume. Category totals append the filterable uncategorised slug, which counts markets with no matching canonical category.

Trader support is capability-qualified by venue:

trades = client.polymarket.fetch_trader_trades("market-id", {"limit": 50})
holders = client.polymarket.fetch_holders("market-id", {"limit": 50})
leaders = client.hyperliquid.fetch_leaderboard({"by": "score", "limit": 50})
profile = client.hyperliquid.fetch_wallet_profile("0x...")

An unsupported upstream capability returns NOT_SUPPORTED; the client does not fabricate trader identity or venue data.

Sports catalogue, screen, and comparison reads are live and metered. When the sports surface is not enabled for your account, calls raise NotFoundError with code ROUTE_NOT_FOUND and are not charged. The screen can be unavailable while catalogue reads still work. Check the code: SPORTS_FIXTURE_NOT_FOUND and SPORTS_BLOCK_NOT_FOUND describe missing data instead. The SDK never retries a 404, fabricates an empty result, or caches availability.

from predictefy import NotFoundError
try:
grid = client.fetch_sports_screen(
competition="epl", market_type="match_result", limit=20,
)
print(grid.meta["degraded"], grid.next_cursor)
for row in grid:
if row["market"] is not None:
print(row["fixtureId"], row["market"]["selections"])
except NotFoundError as exc:
if exc.code != "ROUTE_NOT_FOUND":
raise
print("Sports is not enabled for this account yet; this call was not charged.")

The other reads are fetch_sports_launches, fetch_sports_facets, fetch_sports_competitions, fetch_sports_teams, fetch_sports_fixtures, fetch_sports_fixture, compare_fixture_prices, and fetch_fixture_price_history. Filters are keyword-only; the three fixture-id methods take the id as their first positional argument. Lists retain .meta; screen and fixtures also retain .page and .next_cursor (None on the last page). Pass that cursor with the same filters to read the next page. Launches, facets and fixture detail return the full success, data, meta envelope. For screen and fixture-list reads, window filters from_ and to accept an aware datetime, a date, or an ISO string with seconds and an offset; the default window is 12 hours ago through 7 days ahead, capped at 31 days. Compare has no line filter, and facets have no window filters.

This is a price comparison, not an arbitrage claim. avg, fair, edge, and hold are Predictefy’s own calculations: fair is the no-vig average, and edge is fair / best minus one, which may be negative. Catalog and stale cells never win best; unknown fees have net=None and use gross with edgeOnGross. final means our keyed markets closed, not a settlement claim. The Python CLI mirrors these reads under predictefy sports (see CLI).

fetch_fixture_price_history is not available on every account. Unavailable calls raise NotFoundError with code ROUTE_NOT_FOUND and are not charged.

from datetime import date, datetime, timezone
history = client.fetch_fixture_price_history(
"fixture-id", # an id from fetch_sports_screen rows or fetch_sports_fixtures
market_type="match_result",
interval="1h",
from_=date(2026, 9, 22),
to=datetime(2026, 9, 24, tzinfo=timezone.utc),
)
print(history["data"]["series"])
print(history["meta"])

The method returns the full SportsPriceHistoryResponse envelope: success, data (FixturePriceHistory), and meta (FixturePriceHistoryMeta). meta retains the resolved window, interval, and recorder health; meta.degradedReason is omitted when healthy. from_ and to accept an aware datetime, a date, or an ISO string. The history window defaults to the seven days before the resolved to, but never starts before the plan’s history-window cutoff, and is capped at 31 days. A from_ or to before that cutoff raises ScopeError with code PLAN_REQUIRED. There is no pagination.

Optional stake sizing on client.router.fetch_arbitrage is not available on every account. While it is unavailable, supplying stake raises ValidationError with stake is not enabled. Pass stake in the parameter dictionary:

assessments = client.router.fetch_arbitrage({"stake": 100.5, "limit": 100})

stake is a USD budget: finite, greater than zero, at most 1,000,000, and with at most two decimal places. When stake is supplied, limit must be at most 100. Violating either rule raises ValidationError before any request. The client sends stake as a two-decimal string ("100.50" above). Sizing adds no credits to the existing request weight.

The PyPI package installs a predictefy console script:

Terminal window
export PREDICTEFY_API_KEY=pk_...
predictefy markets polymarket --limit 10 --q fed
predictefy discrepancies --limit 10 --live
predictefy clusters --limit 20
predictefy sports launches
predictefy sports screen --sport soccer --market-type moneyline --limit 10
predictefy sports history fx-123 --market-type moneyline --interval 1h

Add --json for raw JSON. The full verb list is markets <venue>, market <venue> <id>, discrepancies, clusters, account <resource> <venue> [account-id], and the sports family: launches, facets, competitions, teams [query], fixtures, fixture <fixtureId>, screen, compare <fixtureId> and history <fixtureId>. Sports commands share the SDK filters (--sport, --competition, --market-type, --venues, --from/--to and the rest); --json returns the raw SDK result. A deployment can have the sports surface switched off, and every sports command then reports ROUTE_NOT_FOUND without charging the call. Sports answers are a cross-venue price comparison, not an arbitrage claim.

Public execution and client-side signing support is capability-qualified separately; do not infer execution support from data coverage.

Rotate a secret with client.webhooks.rotate(endpoint_id) to issue a new signing secret for an existing webhook endpoint; see Rotating a secret.