Build a live prediction market dashboard with Streamlit — NBA, NHL, MLB consensus with auto-refresh, divergence highlighting, and sport filters.
Connect Streamlit to Meridian Edge to access real-time prediction market consensus from 25+ regulated sources. Build an interactive research dashboard in under 50 lines of Python.
pip install streamlit requestsimport streamlit as st
import requests
import pandas as pd
import time
API_KEY = "me_live_YOUR_KEY"
HEADERS = {"X-API-Key": API_KEY}
st.set_page_config(page_title="Prediction Market Consensus", layout="wide")
st.title("Prediction Market Consensus")
sport = st.selectbox("Sport", ["NBA", "NHL", "MLB", "MLS"])
auto_refresh = st.checkbox("Auto-refresh (30s)", value=True)
@st.cache_data(ttl=30)
def fetch_consensus(sport):
r = requests.get(
"https://meridianedge.io/api/v1/consensus",
headers=HEADERS,
params={"sport": sport, "limit": 20}
)
return r.json().get("events", [])
events = fetch_consensus(sport)
df = pd.DataFrame(events)
if not df.empty:
df["consensus_%"] = (df["consensus_prob"] * 100).round(1)
df["divergence_%"] = (df.get("divergence_pct", 0) * 100).round(1)
st.dataframe(
df[["title", "consensus_%", "divergence_%", "market_count"]],
use_container_width=True
)
if auto_refresh:
time.sleep(30)
st.rerun()Get your API key and deploy this Streamlit app in minutes — local or on Streamlit Cloud.
View Plans → API Reference