Skip to content

Repository files navigation

Stock Analysis AI Agent

An n8n agentic workflow that delivers AI-powered stock analysis via Telegram — supporting text and voice inputs, generating technical charts with RSI and candlestick analysis, saving watchlists to Airtable, and running scheduled batch reports automatically.

What It Does

Users interact with an AI agent through Telegram. They can type or speak a stock ticker, and the agent returns a technical chart plus a detailed analysis covering candlestick patterns, RSI, Stochastic RSI, and volume — in plain English.

A second scenario runs on a schedule: the agent pulls saved tickers from Airtable and generates reports for each one automatically, with no user trigger required.


Workflow Screenshots

Main Workflow — Both Scenarios

Stock Analysis Main Workflow

Chart Generation Sub-Workflow

Chart Generation Sub-Workflow


Architecture

┌─────────────────────────────────────────────────────────┐
│  Scenario 1: Interactive (Telegram)                     │
│                                                         │
│  Telegram Message (text or voice)                       │
│       │                                                 │
│       ▼                                                 │
│  Switch ──── voice ──► Download File ──► Transcribe     │
│       │                                      │          │
│       └──── text ────────────────────────────┘          │
│                          │                              │
│                          ▼                              │
│                    AI Agent (GPT-4o)                    │
│                    + Window Buffer Memory               │
│                       │         │                       │
│                       ▼         ▼                       │
│               Get Chart      Save Ticker → Airtable     │
│               (sub-workflow)                            │
│                   │                                     │
│               Download Chart                            │
│                   │                                     │
│               Technical Analysis (GPT-4o vision)        │
│                   │                                     │
│          ┌────────┴────────┐                            │
│          ▼                 ▼                            │
│     Send Chart        Send Analysis                     │
│     (Telegram)        (Telegram)                        │
└─────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────┐
│  Scenario 2: Scheduled Batch Reports                    │
│                                                         │
│  Schedule Trigger                                       │
│       │                                                 │
│       ▼                                                 │
│  Get Tickers (Airtable)                                 │
│       │                                                 │
│       ▼                                                 │
│  Loop Over Items ──► Run Agent (Webhook) ──► Analysis   │
└─────────────────────────────────────────────────────────┘

Key Features

Flexible Input

  • Text messages via Telegram
  • Voice messages — transcribed via OpenAI Whisper then analyzed
  • Webhook for programmatic triggers
  • Scheduled execution for saved watchlists

Chart Generation

  • Generates candlestick, bar, or line charts per user preference
  • Default: candlestick style
  • Configured with 1-week interval and technical indicators: Volume, RSI, Stochastic RSI
  • Charts delivered as images directly to Telegram

Technical Analysis (GPT-4o Vision)

  • Candlestick pattern interpretation (bullish engulfing, doji, hammer, etc.)
  • RSI value with market positioning (overbought / oversold / neutral)
  • Stochastic RSI K and D line analysis including crossovers and divergences
  • Volume trend interpretation
  • Plain-English conclusions — no jargon

Watchlist & Scheduling

  • Users can save tickers to Airtable via the agent
  • Scheduled trigger runs batch analysis across all saved tickers automatically
  • Each ticker gets its own chart + analysis delivered to Telegram

Conversation Memory

  • Window Buffer Memory keeps context across multi-turn conversations
  • Users can follow up ("what about the RSI on that one?") without repeating the ticker

Tech Stack

Component Tool
Workflow Orchestrator n8n
AI Agent OpenAI GPT-4o
Voice Transcription OpenAI Whisper
Chart Vision Analysis OpenAI GPT-4o (vision)
Notification Telegram Bot API
Data Persistence Airtable
Chart Generation Chart API (candle/bar/line + indicators)

Workflow Files

File Description
trading_agent_workflow.json Full production workflow (import to n8n)
Stock_Analysis_Workflow_Solution.json Alternative solution variant
stock_price_analysis.ipynb Exploratory analysis notebook

Setup

  1. Import trading_agent_workflow.json into your n8n instance
  2. Configure credentials:
    • OPENAI_API_KEY
    • TELEGRAM_BOT_TOKEN + TELEGRAM_CHAT_ID
    • AIRTABLE_API_KEY + Base/Table IDs for watchlist storage
  3. Set your default tickers in the Schedule Trigger node
  4. Activate the workflow

Skills Demonstrated

Multi-trigger agentic workflow design, voice-to-text integration, GPT-4o vision analysis, Telegram bot integration, Airtable data persistence, scheduled automation, conversation memory, sub-workflow architecture

About

Scheduled n8n workflow: live market data → LLM analysis → Telegram buy/sell alerts

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages