<- all tokdocs

Building an AI Stock Analysis Agent With n8n and ChatGPT

Watch on TikTok

View on TikTok ->

This tutorial walks through building a no-code AI agent that performs technical analysis on any stock you ask about. It uses n8n for the workflow automation, ChartImage.com for stock charts, and ChatGPT for the actual analysis. The whole thing takes about five minutes to set up.

Setting Up the Agent

Start at n8n.io with a free account. Create a new workflow and search for the "AI Agent" node. Configure a chat model (OpenAI GPT-4.0 works well), keep the default Windows Buffer Memory settings, and leave the tools section empty for now. The tools will come from a separate workflow.

n8n interface showing a trigger node selection menu with options like "Trigger manually," "On app event," "On a schedule," "On webhook call," and "On chat message"

The Analysis Workflow

The backend workflow handles the actual stock analysis. When the agent receives a message like "analyze Apple," it extracts the ticker symbol and passes it through a chain of modules.

n8n workflow canvas showing the complete stock analysis pipeline: Workflow Input Trigger, Edit Fields, HTTP Request to ChartImage API, HTTP Request to download chart, OpenAI Analyze Image, and Edit Fields output

The pipeline works in stages:

  1. Extract the ticker from the user's message
  2. Fetch the chart from ChartImage.com using their API (copy the curl command from their site)
  3. Download the chart image so it can be sent to ChatGPT
  4. Send the chart to ChatGPT with a prompt telling it how to perform technical analysis
  5. Return the analysis and chart back to the agent

The technical analysis prompt is customizable. You can write your own criteria for what the model should look for, or have ChatGPT generate a prompt for you.

Testing It Out

Hit the chat button at the bottom of n8n, type something like "Can you analyze Tesla's stock?" and the agent returns a written analysis based on the chart along with the chart image itself.

Presenter speaking to camera with text overlay "This AI Agent Analyzes Stocks" and subtitle "CAN CREATE AN"

Extending the Agent

The stock analysis tool can be plugged into a larger personal assistant agent alongside other tools. The creator shows his own setup with multiple tools accessible through Telegram, including voice input and voice responses.

Key Takeaways

  • n8n's AI Agent node combined with a custom workflow creates a stock analysis tool in minutes
  • ChartImage.com provides stock chart images via API
  • ChatGPT analyzes the chart visually and returns written technical analysis
  • The tool can be integrated into a larger personal assistant agent

Resources

  • n8n -- Open-source workflow automation platform
  • ChartImage.com -- Stock chart image API
  • OpenAI API -- GPT-4 for visual chart analysis

Published May 25, 2026. Writeup generated from a favorited TikTok.