Election
Single-page site for tracking election forecasts, betting odds, polls, and news in real time
Install / Use
/learn @Metaculus/ElectionREADME
Who Will Win?
Single-page NextJS app featuring real-time forecasting, betting odds, polls, and news for any given election. It's currently set up for the 2024 presidential election, but could be repurposed for tracking any election.
Running locally
This assumes you have a Postgres database up and running. When you first spin up the database, make sure to run
npx prisma db pushto initialize the tables.
First, install the dependencies:
npm install
Then, create a .env file in the root directory of this codebase with the following variables:
API_URL="http://localhost:3000/api"
DATABASE_URI="" # Postgres URI goes here
SECRET_KEY="jOFASFL3foj3oi4p32O3%$" # Used to authenticate requests from the cron job
NEWSDATA_API_KEY="" # Get one here: https://newsdata.io/free-news-api
METACULUS_API_KEY=""
Then run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the site.
To actually populate the site with data, you need to run a cron job that periodically hits the http://localhost:3000/api/refresh endpoint. This will fetch the latest data from Metaculus, Polymarket, PredictIt, 538 (polls), and news, and add it to the database. Make sure to include the SECRET_KEY (from the .env file above) in the authorization header of the request.
Acknowledgements
Built by Jonathan Shobrook and originally used to power willtrumpwin.com (now associated with Kalshi).
Related Skills
node-connect
339.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.9kCommit, push, and open a PR
