How to Create Your Own Stock-Analysis AI Agent (n8n Template)

summary, key takeaways, and a step-by-step guide with examples to help you build your own AI-powered Telegram stock analysis bot without coding, using N8N, OpenAI, and other APIs.


Summary

In this tutorial, you learn how to create a Telegram bot that performs automated stock analysis with AI. When a user sends a stock symbol (like "AAPL") via Telegram, the bot replies with:

  • A live stock chart

  • A detailed AI-generated technical analysis

This is built using:

  • N8N (an automation platform)

  • OpenAI (for generating natural language analysis)

  • 12Data API (to fetch stock data)

  • Chart-Img API (to generate stock charts)

  • Telegram Bot (as the user interface)


📌 Key Takeaways

  • No coding required: All done through a visual workflow builder (N8N).

  • Affordable: WSK hosting (~₹170/month) is cost-effective.

  • Automation at scale: Easily scalable for other use-cases (crypto, weather, news, etc.).

  • Integration of multiple APIs: Combines Telegram, OpenAI, Chart-Img, and 12Data.

  • Fully customizable: You can add your own conditions, formatting, or timeframes.


🛠️ Step-by-Step Guide (with Examples)

🔹 PART 1: Set Up N8N Platform

Step 1: Host N8N

Choose one of the hosting options:

  • Locally (free) – requires technical setup

  • WSK Hosting (recommended) – ~$14/month, unlimited workflows → Use WSK

  • Official N8N Cloud – $27/month, fewer features

➡️ Example: Choose 12-month WSK plan → Pay → Access dashboard

Step 2: Set Up N8N on WSK

  • Click “Go to Setup”

  • Fill in your credentials

  • You’ll land on the N8N workflow dashboard

Step 3: Import Workflow Template

  • Download the technical analysis workflow template (from the WSK or creator’s GitHub)

  • In N8N, click "Start from scratch" → Import from file

  • Upload the .json file

  • Rename your workflow


🔹 PART 2: Connect Services

Step 4: Connect Telegram

  1. Open Telegram Trigger node

  2. Create new Telegram credentials

  3. Use BotFather in Telegram to:

    • /newbot

    • Set name: Technical Analyst Bot

    • Set username: your_bot_name_bot

  4. Copy the bot API key → Paste into N8N credentials

  5. Click on bot link → Start → Copy your chat ID

  6. Test to confirm it's connected

➡️ Example: Message the bot with "AAPL" and check if workflow is triggered.

Step 5: Connect OpenAI

  1. Create an OpenAI account → https://platform.openai.com

  2. Generate an API key → Copy it

  3. In N8N, open the OpenAI node → Create credentials → Paste API key

  4. Save and test connection


🔹 PART 3: Configure Sub-Workflow

Step 6: Connect 12Data API (for stock data)

  1. Go to https://twelvedata.com → Sign up

  2. Go to API Keys → Generate key → Copy

  3. Paste it in the 12Data node in your N8N workflow

Step 7: Connect Chart-Img API (for stock charts)

  1. Go to https://www.chartimg.com → Sign up

  2. Generate new API key → Copy

  3. Paste into Chart-Img node in N8N

Step 8: Add Telegram Chat ID (for reply)

  • Open Send Chat node in the sub-workflow

  • Paste your Telegram Chat ID (from earlier step)

  • Save workflow


🔹 PART 4: Test Your Bot

Example 1:

Send this in Telegram:

nginx
AAPL

➡️ Bot replies with:

  • 1-week candlestick chart

  • AI explanation (e.g., trend, price movement, support/resistance)

Example 2:

sql
Tata Motors 1day

➡️ Bot replies with:

  • 1-day chart

  • Short-term analysis


✅ Final Notes

  • You can change timeframes, add more APIs, or even automate alerts.

  • Make sure to save your workflow after each change.

  • Use this setup to expand to crypto, forex, mutual funds, etc.


🧠 Next Steps

  • Add user authentication or premium access

  • Schedule daily reports to groups or channels

  • Enable language customization for Hindi or regional users

    Source  : https://youtu.be/jmuFP05YAmc 

Comments

Popular posts from this blog

Fundamentals of Management Theory & Practice

Evolution of Marketing

🚀 ChatGPT Pro Version (Go Plan) is FREE for 12 Months! 🎉