Build interactive prediction market consensus charts with Plotly — probability bars, divergence scatter plots, and live-updating dashboards.
Connect Plotly to Meridian Edge to visualize real-time prediction market consensus from 25+ regulated sources. Create publication-quality interactive charts with just a few lines of Python.
pip install plotly requests pandasimport plotly.express as px
import plotly.graph_objects as go
import requests
import pandas as pd
API_KEY = "me_live_YOUR_KEY"
def get_consensus_df(sport="NBA"):
r = requests.get(
"https://meridianedge.io/api/v1/consensus",
headers={"X-API-Key": API_KEY},
params={"sport": sport, "limit": 15}
)
df = pd.DataFrame(r.json().get("events", []))
df["consensus_pct"] = (df["consensus_prob"] * 100).round(1)
df["title_short"] = df["title"].str[:45]
return df
df = get_consensus_df("NBA")
# Horizontal probability bar chart
fig = px.bar(df.sort_values("consensus_pct"),
x="consensus_pct", y="title_short",
orientation="h",
color="consensus_pct",
color_continuous_scale=["#ef4444","#f59e0b","#22c55e"],
range_color=[0, 100],
title=f"NBA Prediction Market Consensus",
labels={"consensus_pct":"Consensus %","title_short":"Event"})
fig.update_layout(showlegend=False, height=500, template="plotly_dark")
fig.show()
# Divergence scatter
fig2 = px.scatter(df, x="consensus_pct", y="divergence_pct",
hover_name="title", size_max=20,
title="Consensus vs. Divergence")
fig2.show()Get your API key and build interactive prediction market charts with Plotly in minutes.
View Plans → API Reference