Back to Templates

Collect historical prices from Polymarket Up/Down markets into Supabase

Created by

Created by: Caio Carvalho || caio-carvalho

Caio Carvalho

Last update

Last update 4 hours ago

Categories

Share


This n8n template retrieves historical prices from Polymarket serial markets such as Bitcoin Up or Down, S&P 500 Up or Down, and similar markets.

The main use cases are data collection for easier analysis through SQL queries or more advanced pipelines using Python and other programming languages.

How it works

  • Provide the slug of the serial market you want to analyze in the initial form. The workflow is designed for live Polymarket “Up or Down” markets; copy the slug from the current market and submit it.

  • From the slug, the workflow extracts the event ID and derives the corresponding series ID. All events in that series are retrieved, organized, and stored in an internal n8n table. This process runs only once per series to avoid duplicate data.

  • A second workflow reads the stored events, retrieves the Up and Down token IDs, records market closing times, and filters out open markets so only historical data is processed.

  • Market end times are converted to Unix timestamps, and start times are calculated. The workflow is structured for 1-hour markets, but the time-conversion node can be adjusted for other durations.

  • Historical price data is then fetched and stored in a Supabase table for later analysis.

How to use

  • Copy the slug of the desired Up or Down market from Polymarket and submit it through the form.

  • After the first workflow finishes, run the second workflow to collect historical price data.

  • Events are processed in batches of 100 to avoid performance issues. If execution stops, simply rerun the workflow and it will continue from where it left off.