AI forecasts vs. prediction markets for African economic and political development
# AI Forecasting: African Economic and Political Development
Two language models — Claude and GPT — estimate the probability of open questions
about African politics and economics. Their estimates are published next to the
corresponding prediction-market price. Neither model ever sees that price, so the
two numbers are independent.
**Live dashboard:
niklaswenzin.github.io
The site is rebuilt from live data, so the numbers below will differ from
whatever you see today.
## What it does
Three scripts, run in order:
| Script | Does | Writes |
|---|---|---|
| `fetch_markets.py` | Loads open questions from every configured source, keeps those with an African subject, drops sports questions, takes at most one question per country | `markets.json` |
| `forecast.py` | One API call per question and per model, both with web search, returns validated JSON | `forecasts.json` |
| `build_site.py` | Renders the static dashboard | `docs/index.html` |
```bash
python fetch_markets.py && python forecast.py && python build_site.py
```
`forecast.py --nur-fehlende` only queries questions that have no forecast yet.
Useful when a run is cut short — an exhausted API balance, a network failure —
and the remainder should be filled in without paying for the finished ones again.
`snapshot.py` is optional and runs after `forecast.py`. It appends the current
state to `data/history/` so that a later evaluation can score each forecast
against the information available when it was made. Nothing on the site depends
on it.
## Quickstart
Python 3.10 or newer.
```bash
pip install requests anthropic
```
API keys are read from environment variables, or from a local `.env` file
excluded by `.gitignore`: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY` and
`METACULUS_API_TOKEN`. They must never be committed.
Only `fetch_markets.py` and `build_site.py` run without keys; `forecast.py`
needs both model keys. A full run of ten questions costs one to two Swiss francs.
## Sourc …