Skip to main content

Overview

The Poly Storage Python SDK wraps the Entity Market Data API and provides typed method groups for:
  • API keys
  • Polymarket market data
  • Kalshi market data
  • Health checks
SDK repository:

Install

Use one of these install methods:
python3 -m pip install --upgrade poly-storage-sdk
For CLI + SDK usage from the terminal, see CLI.

Initialize client

from poly_storage_sdk import PolyStorageClient

client = PolyStorageClient(
    api_key="YOUR_API_KEY",
    base_url="https://api.entityml.com",  # /api/v1 is added automatically
)

Polymarket example

market_data = client.polymarket.get_market_data(
    condition_id="0x8213d395e079614d6c4d7f4cbb9be9337ab51648a21cc2a334ae8f1966d164b4",
    date="2026-02-13",
    offset=0,
    limit=500,
)

summary = client.polymarket.get_orderbook_summary(
    condition_id="0x8213d395e079614d6c4d7f4cbb9be9337ab51648a21cc2a334ae8f1966d164b4",
    date="2026-02-13",
    resolution=60,
)

Kalshi example

kalshi_data = client.kalshi.get_market_data(
    ticker="KXBTC-26FEB2606-B60125",
    date="2026-02-26",
    offset=0,
    limit=500,
)

kalshi_summary = client.kalshi.get_orderbook_summary(
    ticker="KXBTC-26FEB2606-B60125",
    date="2026-02-26",
    resolution=60,
)

API keys example

created = client.api_keys.create(name="my-key", user_id="YOUR_USER_ID")
keys = client.api_keys.list(user_id="YOUR_USER_ID")

Error handling

from poly_storage_sdk import PolyStorageAPIError, PolyStorageAuthError

try:
    health = client.system.health()
except PolyStorageAuthError as err:
    print("Auth failed:", err.detail)
except PolyStorageAPIError as err:
    print("Request failed:", err.status_code, err.detail)

Notes

  • Market data endpoints require an API key.
  • Historical coverage is source-specific.
  • Orderbook data exists for a subset of markets from 2025-09-01 on Polymarket and 2026-02-17 for Kalshi, but coverage is not continuous.
  • Continuous Polymarket crypto-related market coverage begins on 2026-02-04. Continuous Kalshi crypto-related market coverage begins on 2026-02-25.
  • Continuous coverage for all markets begins 2026-04-02 for Polymarket and 2026-03-31 for Kalshi.
  • Use the Polymarket and Kalshi date-range endpoints to confirm per-market availability.