# Collect historical price data: n8n workflow template

> Started by someone submitting a form, and works across Supabase and n8n data table. 18 steps, 1 branch: a working afternoon to understand properly.

Source: https://millionrounds.com/workflow/collect-historical-price-data (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Data collection](https://millionrounds.com/workflows?category=Data+collection#library)

# Collect historical price data

Started by someone submitting a form, and works across Supabase and n8n data table. 18 steps, 1 branch: a working afternoon to understand properly.

Medium

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcollect-historical-price-data)

**18 steps** Medium: a working afternoon

**1** Branch: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 2 Logic 5 Service 11

The steps in the order they run, from what starts it.

- 1 **Form to include slug of the market** Form trigger *Starts it*
- 2 **Start Getting Prices Data** Manual trigger *Starts it*
- 3 **Find the Event ID from the Slug** Http Request *Service*
- 4 **Fetch 100 unprocessed events** Data Table *Service*
- 5 **Find the Series ID from the slug** Http Request *Service*
- 6 **Fetch UP/DOWN tokens and end time** Http Request *Service*
- 7 **Find All the Events for that Series ID** Http Request *Service*
- 8 **Store UP/DOWN tokens and end time** Data Table *Service*
- 9 **Split Events into Itens** Split Out *Logic*
- 10 **Check if market has closed** If *Logic*
- 11 **Register Events in Table Polymarket_Btc_1h_Event_List_1** Data Table *Service*
- 12 **Mark open markets as processed** Data Table *Service*
- 13 **Convert end time to Unix timestamp** Date Time *Logic*
- 14 **Convert end time to numeric and set start time** Set *Logic*
- 15 **Fetch price history** Http Request *Service*
- 16 **Split prices and timestamps into arrays** Set *Logic*
- 17 **Store in Supabase** Supabase *Service*
- 18 **Mark as processed** Data Table *Service*

## How it's built

- **Starts on:** Someone submitting a form
- **Steps:** 18, with 1 branch
- **Size:** Medium: a working afternoon
- **Connects to:** Supabase, n8n data table
- **Model:** None. This is plumbing, not judgement

## Questions

What does it need to run?

An n8n account, plus your own Supabase account. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone submitting a form.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Plan an afternoon. 18 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 18 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcollect-historical-price-data)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Supabase](https://millionrounds.com/workflows?service=Supabase#library)[n8n data table](https://millionrounds.com/workflows?service=n8n+data+table#library)

## Workflows like it

Also data collection, with the same services where possible, closest in size first.

- [**Handle GDPR access and erasure emails with Gmail and OpenAI** 18 steps · calls a model · Airtable, Gmail](https://millionrounds.com/workflow/handle-gdpr-access-and-erasure-emails-with-gmail-and-openai)
- [**Write weekly AI news digests with Gluecrawl and OpenAI** 18 steps · calls a model · n8n data table](https://millionrounds.com/workflow/write-weekly-ai-news-digests-with-gluecrawl-and-openai)
- [**Provide real-time updates for Notion databases with Supabase** 19 steps · Notion, Supabase](https://millionrounds.com/workflow/provide-real-time-updates-for-notion-databases-with-supabase)
- [**AI financial assistant for WhatsApp with Supabase** 19 steps · calls a model · Supabase](https://millionrounds.com/workflow/ai-financial-assistant-for-whatsapp-with-supabase)
- [**Build a RAG knowledge chatbot with OpenAI and Google Drive** 17 steps · calls a model · Google Drive, Supabase](https://millionrounds.com/workflow/build-a-rag-knowledge-chatbot-with-openai-and-google-drive)
- [**Build your own RAG-ready vector database in seconds – no SQL, no** 17 steps · calls a model · Google Drive, Supabase](https://millionrounds.com/workflow/build-your-own-rag-ready-vector-database-in-seconds-no-sql-n)
