How I Built A Technical Analyst AI Agent in n8n With No Code

How I Built A Technical Analyst AI Agent in n8n With No Code

Brief Summary

This video provides a comprehensive walkthrough of building an AI agent that analyzes stock charts using technical indicators. It details how to create a workflow in n8n that fetches stock charts, analyzes them using OpenAI, and delivers the analysis via Telegram. The tutorial covers setting up API requests, integrating AI models, and configuring the agent for effective financial analysis.

  • The AI agent analyzes stock charts and delivers insights via Telegram.
  • The workflow involves fetching charts, analyzing them with OpenAI, and communicating results.
  • The tutorial provides a free downloadable workflow template and promotes additional resources for learning and AI consulting.

Demo

The AI agent is set up to analyze Apple stock. It sends the stock ticker to a tool called "get chart," which retrieves a chart with technical indicators and creates a brief analysis. This analysis is then sent back to the agent, which uses Anthropic 3.5 to create a more in-depth analysis. The chart and analysis are sent to the user via Telegram. The analysis includes Candlestick patterns, MACD, volume, and support and resistance levels, providing key takeaways and interpretations. The analysis is not financial advice but rather a technical overview of the stock's current market conditions.

How to Download the Workflow (FREE)

The workflow discussed in the video is available for free download by joining the creator's School community. The link is in the description, and the workflow can be found in the YouTube resources section. To import the workflow into n8n, click the three dots and select "import from file." The creator also mentions a paid community for more hands-on learning and AI consulting services available through their website.

The Agent Workflow

The agent workflow is simple, utilizing a single tool called "get chart." Communication with the agent occurs through Telegram, triggered by incoming messages. The Telegram chat ID is essential for directing communications. Anthropic 3.5 Claude is used for content creation and detailed analysis due to its superior formatting capabilities. The "get chart" tool is prompted to provide an analysis of a requested stock, with the URL output in markdown format for image display. The agent is prompted to understand financial topics and use the "get chart" function, with examples and standard operating procedures provided.

Get Chart Workflow

The "get chart" workflow involves fetching and analyzing stock data. To test the workflow without calling the agent, data can be pinned, setting the query to a specific stock like Apple. The workflow begins by retrieving the query, which is the stock ticker. The ticker is then set as an output field for visual organization. Two HTTP requests are made: a POST request to the Chart-Img API to get the chart and a GET request to download the chart. The agent is prompted to send only the ticker to the "get chart" tool.

Setting Up POST Request to Chart-Img

To set up the POST request, navigate to chart-img.com and access the API documentation to obtain a free API key. The base API endpoint is required for accessing the service. Authentication can be done via authorization bearer or X-API key. The tutorial recommends using the trading view snapshot V2 for easier setup. By copying the curl command from the trading view snapshot example and importing it into n8n, the necessary headers and JSON body are automatically set up. The API key must be entered to complete the setup. To receive the URL, the chart must be saved to storage by adding "-storage" to the end of the endpoint URL and setting the content type to application/json in the headers.

OpenAI Analyze Image Node

The binary image from the GET request is fed into the OpenAI Analyze Image node. The node is configured with the role of a financial analyst specializing in technical analysis of stock charts. The model analyzes the image, generates a brief technical analysis, and sends it over. The detail is set to auto, and the most powerful model, GPT-4, is selected for image analysis. The URL obtained from the GET chart URL node is used to access the file.

Responding to Agent

The response from the OpenAI analysis is sent back to the agent. A field called "response" is set to the name "response," and the output from the technical analysis OpenAI node is sent. The agent then uses this information to create a more in-depth analysis. The response is accessed via item.json.choices.message.content, which aligns with the response received by the agent tool.

Reviewing Agent Log

The agent logs show the process of updating the window buffer memory and using the model to understand the prompt. The agent confirms it will analyze the latest chart for Apple Inc. and generates the chart. The input for the next node, "get chart," is just the ticker "Apple." The agent receives the response from the workflow, sends it back to the Anthropic chat model, and creates a more in-depth analysis. The final message in Telegram references the actual message to be json.output, which is the output from the AI agent.

Share

Summarize Anything ! Download Summ App

Download on the Apple Store
© 2024 Summ