How to Create Your Own Stock-Analysis AI Agent (n8n Template)
A 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
.jsonfile -
Rename your workflow
🔹 PART 2: Connect Services
Step 4: Connect Telegram
-
Open Telegram Trigger node
-
Create new Telegram credentials
-
Use BotFather in Telegram to:
-
/newbot -
Set name:
Technical Analyst Bot -
Set username:
your_bot_name_bot
-
-
Copy the bot API key → Paste into N8N credentials
-
Click on bot link → Start → Copy your chat ID
-
Test to confirm it's connected
➡️ Example: Message the bot with "AAPL" and check if workflow is triggered.
Step 5: Connect OpenAI
-
Create an OpenAI account → https://platform.openai.com
-
Generate an API key → Copy it
-
In N8N, open the OpenAI node → Create credentials → Paste API key
-
Save and test connection
🔹 PART 3: Configure Sub-Workflow
Step 6: Connect 12Data API (for stock data)
-
Go to https://twelvedata.com → Sign up
-
Go to API Keys → Generate key → Copy
-
Paste it in the 12Data node in your N8N workflow
Step 7: Connect Chart-Img API (for stock charts)
-
Go to https://www.chartimg.com → Sign up
-
Generate new API key → Copy
-
Paste into Chart-Img node in N8N
Step 8: Add Telegram Chat ID (for reply)
-
Open
Send Chatnode 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:
➡️ Bot replies with:
-
1-week candlestick chart
-
AI explanation (e.g., trend, price movement, support/resistance)
Example 2:
➡️ 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
Post a Comment