# Automate stock trades with Claude and OpenAI: n8n workflow

> Started by a clock, and works across Gmail and Supabase vectors. It puts Claude, OpenAI and one other behind a retrieval step, so answers are drawn from...

Source: https://millionrounds.com/workflow/automate-stock-trades-with-claude-and-openai (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Research and reporting](https://millionrounds.com/workflows?category=Research+and+reporting#library)

# Automate stock trades with Claude and OpenAI

Started by a clock, and works across Gmail and Supabase vectors. It puts Claude, OpenAI and one other behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 70 steps: large, and worth reading before you trust it with anything live.

Large Calls a model: Claude, OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomate-stock-trades-with-claude-and-openai)

**70 steps** Large: read it before trusting it with anything live

**0** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 1 Model 27 Logic 14 Service 18

The steps in the order they run, from what starts it. The first 60 of 70.

- 1 **Think** Tool Think *Model*
- 2 **Embeddings OpenAI** Embeddings Open Ai *Model*
- 3 **Recursive Character Text Splitter** Text Splitter Recursive Character Text Splitter *Model*
- 4 **Embeddings OpenAI1** Embeddings Open Ai *Model*
- 5 **Reranker Cohere** Reranker Cohere *Model*
- 6 **ranking** Http Request Tool *Service*
- 7 **sectors** Http Request Tool *Service*
- 8 **industries** Http Request Tool *Service*
- 9 **Technical Analysis Tool1** Tool Workflow *Model*
- 10 **Trends Analysis Tool1** Tool Workflow *Model*
- 11 **Think2** Tool Think *Model*
- 12 **Edit Fields1** Set *Logic*
- 13 **OpenRouter Chat Model2** Lm Chat Open Router *Model*
- 14 **Set Stock Symbol and API Key** Set *Logic*
- 15 **Generate Variables For API1** Code *Logic*
- 16 **Calculator** Tool Calculator *Model*
- 17 **save order info** Postgres Tool *Service*
- 18 **POST endpoints** Http Request Tool *Service*
- 19 **GET endpoints** Http Request Tool *Service*
- 20 **GET cash** Http Request Tool *Service*
- 21 **Think1** Tool Think *Model*
- 22 **Calculator1** Tool Calculator *Model*
- 23 **Schedule Trigger** Schedule trigger *Starts it*
- 24 **OpenRouter Chat Model** Lm Chat Open Router *Model*
- 25 **GET cash1** Http Request Tool *Service*
- 26 **Think3** Tool Think *Model*
- 27 **OpenRouter Chat Model1** Lm Chat Open Router *Model*
- 28 **OpenRouter Chat Model3** Lm Chat Open Router *Model*
- 29 **current trades** Postgres Tool *Service*
- 30 **current trades1** Postgres Tool *Service*
- 31 **Grok 4** Lm Chat Open Router *Model*
- 32 **Call trend + technical Agent** Tool Workflow *Model*
- 33 **Anthropic Chat Model** Lm Chat Anthropic *Model*
- 34 **MAIN AGENT** Agent *Model*
- 35 **Supabase Vector Store1** Vector Store Supabase *Model*
- 36 **Default Data Loader** Document Default Data Loader *Model*
- 37 **Supabase Vector Store** Vector Store Supabase *Model*
- 38 **Trend + Technical Agent** Agent *Model*
- 39 **Get Price History** Http Request *Service*
- 40 **Get Bollinger Bands** Http Request *Service*
- 41 **Get MACD** Http Request *Service*
- 42 **Split Out3** Split Out *Logic*
- 43 **Trader Agent** Agent *Model*
- 44 **strategy agent** Agent *Model*
- 45 **HTTP Request1** Http Request *Service*
- 46 **Strategy Agent** Agent Tool *Model*
- 47 **Edit Fields5** Set *Logic*
- 48 **Markdown to HTML** Markdown *Logic*
- 49 **Calculate Support Resistance** Code *Logic*
- 50 **Edit Fields** Set *Logic*
- 51 **Merge** Merge *Logic*
- 52 **Edit Fields3** Set *Logic*
- 53 **Filter** Filter *Logic*
- 54 **Send report** Gmail *Service*
- 55 **Get Chart URL** Http Request *Service*
- 56 **Organizing Data** Code *Logic*
- 57 **Get News Data1** Http Request *Service*
- 58 **Download Chart** Http Request *Service*
- 59 **Merge-2** Merge *Logic*
- 60 **Aggregate1** Aggregate *Logic*

## How it's built

- **Starts on:** A clock
- **Steps:** 70
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Supabase vectors
- **Model:** Claude, OpenAI, OpenRouter
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Gmail and Supabase vectors accounts, and a key for Claude and OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on a clock.

Does it use AI?

Yes. It calls Claude, OpenAI and OpenRouter. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 70 steps it is large: read it before trusting it with anything live.

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 70 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%2Fautomate-stock-trades-with-claude-and-openai)
- **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.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Supabase vectors](https://millionrounds.com/workflows?service=Supabase+vectors#library)

## Workflows like it

Also research and reporting, with the same services where possible, closest in size first.

- [**Generate stock market investment reports** 75 steps · calls a model · Gmail](https://millionrounds.com/workflow/generate-stock-market-investment-reports)
- [**Business AI command center: Modular agents** 58 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/business-ai-command-center-modular-agents)
- [**Automated Google Business reports with OpenAI** 56 steps · calls a model · Gmail, Google Business Profile](https://millionrounds.com/workflow/automated-google-business-reports-with-openai)
- [**Create a Stakeholder 360 Report with OpenAI and Gmail** 56 steps · calls a model · Gmail, Notion](https://millionrounds.com/workflow/create-a-stakeholder-360-report-with-openai-and-gmail)
- [**AI-powered stock analysis with OpenAI and OpenRouter** 54 steps · calls a model · Gmail, Supabase vectors](https://millionrounds.com/workflow/ai-powered-stock-analysis-with-openai-and-openrouter)
- [**Analyze Google Ads competitors with OpenRouter and OpenAI** 39 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/analyze-google-ads-competitors-with-openrouter-and-openai)
