depthfeed
Python client for DepthFeed — historical order-book depth for prediction markets.
Prediction-market venues publish a live order book and archive none of it. Once a short-dated market resolves, its depth history is gone and cannot be backfilled by anyone. DepthFeed records it — full bid/ask ladders on both sides, captured event-driven rather than sampled — and serves it over a REST API. This is the client for that API.
Coverage: Polymarket, Kalshi and Limitless, across BTC, ETH, SOL, XRP, DOGE, BNB and HYPE.
pip install depthfeed
Quickstart
Create a free account at depthfeed.com/signup and mint an API
key from the dashboard. Keys look like df_… and are shown once.
from depthfeed import DepthFeed
client = DepthFeed() # reads DEPTHFEED_API_KEY, or pass api_key="df_…"
print(client.whoami()) # your plan, rate limits, history window
markets = client.markets("btc", limit=5)
for market in markets:
print(market["market_id"])
Order-book depth
The point of the API. Pass include_orderbook=True to get the full ladder rather than
summary fields.
snapshots = client.snapshots(
"btc",
market_id,
interval="1m",
include_orderbook=True,
start_time="2026-08-01T00:00:00Z",
end_time="2026-08-02T00:00:00Z",
)
for snap in snapshots:
best_bid = snap["orderbook"]["bids"][0]
print(snap["timestamp"], best_bid["price"], best_bid["size"])
For the book in force at one instant, snapshot_at takes a timestamp directly (crypto coins
only — for the other venues, use snapshots with a narrow window):
book = client.snapshot_at("btc", market_id, "2026-08-01T12:00:00Z")
Pagination
List endpoints use opaque keyset cursors. The iter_* methods follow them for you and yield
items one at a time, so a long window streams instead of accumulating in memory.
for market in client.iter_markets("btc"):
...
for snap in client.iter_snapshots("btc", market_id, include_orderbook=True):
...
If you want the pages themselves, the single-page methods expose the cursor:
page = client.markets("btc", limit=100)
page.next_cursor # feed back as cursor=
page.has_more
page.request_id # from the response meta block, useful in support requests
Venues
Crypto assets are addressed by coin; the other venues have their own roots. The client handles the path difference — pass the venue as the first argument either way.
client.markets("btc") # /v3/btc/markets
client.markets("kalshi") # /v3/kalshi/markets
client.markets("limitless") # /v3/limitless/markets
client.snapshots("kalshi", "TICKER") # /v3/kalshi/TICKER/snapshots
client.screener("btc", "15m") # /v3/screener/btc/15m
client.screener() # /v3/screener — cross-asset
Binance spot and futures reference data sits on a different path shape and has its own methods, so the two families don't get confused:
client.reference_latest("btc", "spot") # /v3/btc/spot/latest
client.reference_snapshots("btc", "futures") # /v3/btc/futures/snapshots
client.reference_trades("btc", "spot", latest=True) # /v3/btc/spot/trades/latest
Any endpoint this client does not wrap yet is reachable directly, with the same auth, retry and envelope handling:
client.get("/v3/sports/markets", league="mlb", limit=10)
Async
AsyncDepthFeed mirrors the sync client method for method.
import asyncio
from depthfeed import AsyncDepthFeed
async def main():
async with AsyncDepthFeed() as client:
markets = await client.markets("btc", limit=5)
async for snap in client.iter_snapshots("btc", markets[0]["market_id"]):
...
asyncio.run(main())
Errors
HTTP statuses map to typed exceptions, all deriving from DepthFeedError.
| Status | Exception |
|---|---|
| 400 | BadRequestError |
| 401 | AuthenticationError |
| 402 | PaymentRequiredError |
| 403 | PermissionDeniedError |
| 404 | NotFoundError |
| 429 | RateLimitError (carries retry_after) |
| 5xx | ServerError |
from depthfeed import RateLimitError
try:
client.markets("btc")
except RateLimitError as exc:
print(exc.retry_after, exc.request_id)
429, 408 and 5xx responses are retried automatically with exponential backoff, honouring
Retry-After. Set max_retries=0 to turn that off.
Configuration
DepthFeed(
api_key=None, # else DEPTHFEED_API_KEY
base_url="https://api.depthfeed.com",
timeout=30.0,
max_retries=3,
)
Links
- Documentation — https://depthfeed.com/docs
- API reference — https://depthfeed.com/data-api
- MCP server — https://depthfeed.com/mcp
Independent project. Not affiliated with Polymarket, Kalshi, Binance, Chainlink or Limitless.
MIT licensed.
Metadata
Release files for depthfeed 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| depthfeed-0.1.0.tar.gz | 11.1 kB | Without provenance | Details for depthfeed-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| depthfeed-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for depthfeed-0.1.0-py3-none-any.whl |
Total release size: 22.7 kB
Release files / depthfeed-0.1.0.tar.gz
| Download URL | depthfeed-0.1.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29b029474f0dff61ba150369be4328d95992f70567e12236152c0126f3f841da
|
|
BLAKE2b-256 checksum How to use checksums |
393ad16fd63a36a014b8680a566418fac7b5ffbe431576c9b129a0af546da2e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.10
|
Release files / depthfeed-0.1.0-py3-none-any.whl
| Download URL | depthfeed-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59a3680128d064d7b0992e0238db4ea3c6277d16b6eed287426087c962aaf000
|
|
BLAKE2b-256 checksum How to use checksums |
5d2714648b996322326236bfa8fe54c1541b91a791c3ccf945486c8637708bf4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.10
|
Security for depthfeed 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.