Skip to content

Export forecasts to a spreadsheet

You will build: a CSV of every forecast in your workspace’s sectors, one row each, ready for a spreadsheet or BI tool, and a check of the track record against the API’s own figure.

You need: a key with intel:read.

GET /forecasts does not page: limit=200 with status=all returns up to the 200 most recent. Ask per sector if you need more than that.

Terminal window
curl "https://dash.alethman.com/api/v1/forecasts?status=all&limit=200" \
-H "Authorization: Bearer $ALETHMAN_KEY"

Beside data, the response carries counts and track_record. Both cover every forecast in your sectors, not only the page returned:

{
"counts": { "open": 90, "due_this_week": 42, "awaiting": 71, "resolved": 351 },
"track_record": { "resolved": 294, "void": 57, "brier_score": 0.22685238095238117 }
}
"""forecasts.csv: every forecast in the workspace's sectors."""
import csv
import os
import requests
API = "https://dash.alethman.com/api/v1"
s = requests.Session()
s.headers["Authorization"] = f"Bearer {os.environ['ALETHMAN_KEY']}"
sectors = s.get(f"{API}/workspace", timeout=30).json()["scope"]["sectors"]
rows = {}
for sector in sectors:
r = s.get(f"{API}/forecasts", params={"sector": sector, "status": "all", "limit": 200}, timeout=30)
r.raise_for_status()
for f in r.json()["data"]:
rows[f["id"]] = f
cols = ["id", "sector", "question", "probability", "made_at", "resolves_by", "status", "outcome", "resolved_at", "resolution_rule", "verdict"]
with open("forecasts.csv", "w", newline="", encoding="utf-8") as out:
w = csv.DictWriter(out, fieldnames=cols, extrasaction="ignore")
w.writeheader()
w.writerows(sorted(rows.values(), key=lambda f: f["made_at"], reverse=True))
judged = [f for f in rows.values() if f["outcome"] is not None]
if judged:
brier = sum((f["probability"] - f["outcome"]) ** 2 for f in judged) / len(judged)
print(f"{len(rows)} forecasts, {len(judged)} judged, Brier {brier:.3f}")
Column Notes
probability 0 to 1, the chance given when the forecast was made. It never changes afterwards.
resolves_by The deadline. A forecast past it with no verdict has status awaiting.
outcome true came true, false did not, empty until judged. A resolved forecast with an empty outcome was voided: the question could not be settled as asked.
resolution_rule What counts as yes, written when the forecast was made.

Forecasts are made and judged daily. Rerun the export daily and replace the file; rows are keyed by id, and a forecast’s status, outcome, resolved_at and verdict fill in when it is judged.