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.
pip install fastapi uvicorn requestsfrom 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)Get your API key and run this FastAPI server locally or deploy to Railway, Render, or any cloud provider.
View Plans → API Reference