Skip to main content

OddsPipe Python SDK

Python client for the OddsPipe prediction market API.

Install

pip install oddspipe

Quick start

from oddspipe import OddsPipe

client = OddsPipe(api_key="your-api-key")

# List top markets by volume
markets = client.markets(limit=10)
for m in markets["items"]:
    print(m["title"], m["spread"])

# Search for a market
results = client.search("Trump", platform="polymarket")

# Get OHLCV candlesticks
candles = client.candlesticks(market_id=123, interval="1h", limit=100)
for c in candles["candles"]:
    print(c["timestamp"], c["close"], c["volume"])

# Find cross-platform price divergences
spreads = client.spreads(min_spread=0.03)
for item in spreads["items"]:
    print(item["polymarket"]["title"], item["spread"]["yes_diff"])

# Most-traded matched pairs first (default sort="spread": largest divergence first)
liquid = client.spreads(sort="volume", min_score=95, limit=5)

# Cross-platform spread for a single market
spread = client.spread(market_id=123)
print(spread["sources"])
print(spread["spread"])

API reference

Method Endpoint Description
markets() GET /v1/markets List markets with latest prices
market(id) GET /v1/markets/{id} Single market detail
search(q) GET /v1/markets/search Full-text search
history(id) GET /v1/markets/{id}/history Raw price snapshots
candlesticks(id) GET /v1/markets/{id}/candlesticks OHLCV candles (1m/5m/1h/1d)
spread(id) GET /v1/markets/{id}/spread Cross-platform spread
spreads() GET /v1/spreads Cross-platform price spreads

Error handling

from oddspipe import OddsPipe, OddsPipeError

client = OddsPipe(api_key="your-key")
try:
    client.market(999999)
except OddsPipeError as e:
    print(e.status_code)  # 404
    print(e.body)         # {"detail": "Market not found"}

A few older markets hold more than one contract on the same venue. For those, history(), candlesticks() and spread() raise OddsPipeError with status 409 instead of mixing contracts; pick one with source_id=:

try:
    candles = client.candlesticks(market_id=123)
except OddsPipeError as e:
    if e.status_code != 409:
        raise
    first = e.body["detail"]["sources"][0]["source_id"]
    candles = client.candlesticks(market_id=123, source_id=first)

Release files for oddspipe 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oddspipe 0.4.0
File Size Uploaded
oddspipe-0.4.0.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oddspipe 0.4.0
File Interpreter ABI Platform
oddspipe-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / oddspipe-0.4.0.tar.gz

Download URL oddspipe-0.4.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b96dd847c5ca5c6341510826ab55981155c51038dfd5497059fc661d3e6d7448
BLAKE2b-256 checksum
How to use checksums
2dff8b73c6fb5ac7892e5ed6762b7d477bb49ed74b98172f9b3a3083ea1606ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / oddspipe-0.4.0-py3-none-any.whl

Download URL oddspipe-0.4.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26d20decfb8a10f9df38c440eab00a15abe06e50d77679202496e0d2f93f7201
BLAKE2b-256 checksum
How to use checksums
64f3b44131b5648ab2d1039fa78d19a21589eeb64c38cd02d21096543ea30582
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page