Prediction Market API — Python Guide

Complete Python examples for fetching consensus data, filtering by sport, and building a divergence monitor — from zero to running in under 5 minutes.

Prerequisites

Basic fetch

import requests

API_KEY = "me_live_your_key_here"  # get yours at the pricing page
BASE    = "https://meridianedge.io/api/v1"
HDRS    = {"X-API-Key": API_KEY}

r = requests.get(f"{BASE}/consensus", headers=HDRS,
                 params={"sport": "NBA", "limit": 10})
r.raise_for_status()

for event in r.json()["events"]:
    print(f"{event['title']:<50} {event['consensus_prob']:.0%}")

Filter by divergence

events = r.json()["events"]
high_div = [e for e in events if e.get("divergence_pct", 0) > 0.04]
for e in high_div:
    print(f"DIVERGENCE: {e['title']} — {e['divergence_pct']:.1%}")

Load into pandas

import pandas as pd

df = pd.DataFrame(r.json()["events"])
df = df.sort_values("divergence_pct", ascending=False)
print(df[["title", "consensus_prob", "divergence_pct", "market_count"]].head(10))

Check your account usage

acct = requests.get(f"{BASE}/account", headers=HDRS).json()
print(f"Calls today: {acct['calls_today']} / {acct['calls_today'] + acct['calls_remaining']}")

Multi-sport loop

SPORTS = ["NBA", "NHL", "MLB", "MLS"]
all_events = []
for sport in SPORTS:
    resp = requests.get(f"{BASE}/consensus", headers=HDRS,
                        params={"sport": sport, "limit": 20})
    all_events.extend(resp.json().get("events", []))

df = pd.DataFrame(all_events)
print(f"Total events: {len(df)}")
print(df.groupby("sport")["consensus_prob"].describe())

Frequently asked questions

How do I call a prediction market API from Python?
Use the requests library. Set the X-API-Key header to your API key and call the /api/v1/consensus endpoint. The response is JSON with an events array.
What Python libraries do I need for prediction market data?
requests for HTTP calls, json for parsing (built-in), and optionally pandas for data analysis. No special SDK is required.
Can I use prediction market data with pandas?
Yes. Load the events list directly into a pandas DataFrame: df = pd.DataFrame(r.json()['events']). Then filter, sort, and analyze using standard pandas operations.

Get API Access

Plans start at $29/mo. 1,000 calls/day. Key in 10 seconds.

View Plans →

Need more? Starter ($29/mo) — 1,000 calls/day + divergence signals