PYTHON ยท API

Meridian Edge + FastAPI

Use FastAPI to build a prediction market data proxy, webhook receiver, or alert service backed by Meridian Edge consensus data.

Connect FastAPI to Meridian Edge to access real-time prediction market consensus from 25+ regulated sources. Build a production-ready API proxy with caching, filtering, and custom endpoints in under 50 lines.

Requirements

Installpip install fastapi uvicorn requests

Integration Code

FastAPI Proxy + Webhookpython
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import requests, uvicorn

app     = FastAPI(title="Prediction Market Proxy")
API_KEY = "me_live_YOUR_KEY"
HEADERS = {"X-API-Key": API_KEY}
BASE    = "https://meridianedge.io/api/v1"

@app.get("/consensus/{sport}")
async def consensus(sport: str, limit: int = 10):
    r = requests.get(f"{BASE}/consensus",
                     headers=HEADERS,
                     params={"sport": sport.upper(), "limit": limit})
    if r.status_code != 200:
        raise HTTPException(status_code=r.status_code, detail="Upstream error")
    return r.json()

@app.get("/divergence/{sport}")
async def divergence(sport: str, threshold: float = 0.04):
    r = requests.get(f"{BASE}/consensus",
                     headers=HEADERS,
                     params={"sport": sport.upper(), "limit": 50})
    events = r.json().get("events", [])
    return {"events": [e for e in events if e.get("divergence_pct", 0) >= threshold]}

if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8000)

Try it โ€” API key in 10 seconds

Get your API key and run this FastAPI server locally or deploy to Railway, Render, or any cloud provider.

View Plans → API Reference

Frequently Asked Questions

How do I use FastAPI with prediction market data?
Call the Meridian Edge REST API from your FastAPI route handlers using the requests library. Use an async HTTP client like httpx for production. Cache responses with fastapi-cache2 to stay within rate limits.
What does FastAPI + Meridian Edge cost?
Yes. Meridian Edge starter tier: 100 calls/day. FastAPI is open source. Get a key at meridianedge.io/#pricing.