Analyze daily stock news sentiment with Gemini AI, Google Sheets and Gmail
Stock News Sentiment Automation using Gemini AI, Google Sheets & Gmail
This workflow automatically fetches daily stock market news, analyzes sentiment using Gemini AI, calculates impact scores, sends alerts for high-impact news and stores structured results in Google Sheets.
Quick Implementation Steps
Import the workflow into your n8n account Configure the Market News API (HTTP Request node) Add your Google Gemini API credentials Connect Google Sheets and create required columns Configure Gmail node (add recipient email) Activate the workflow
What It Does
This workflow runs every day at 8 AM and automatically collects the latest stock market news from a public API. It filters, cleans and processes the data to ensure only relevant and unique articles are analyzed.
Each news article is sent to Google Gemini AI, which classifies the sentiment as bullish, bearish or neutral, along with a confidence score and reasoning. The workflow then calculates an impact score based on sentiment and confidence.
High-impact news is immediately flagged and sent via email alerts, while all processed results are stored in a structured format in Google Sheets for tracking and analysis.
Who It's For
Stock traders and investors
Financial analysts
Algo trading developers
FinTech startups
Anyone tracking market sentiment automatically
Requirements
To use this workflow, you need:
n8n account (cloud or self-hosted)
Public Market News API (already used in workflow)
Google Gemini API credentials
Google Sheets account
Gmail account for sending alerts
How It Works & Setup Guide
- Trigger Setup
The workflow starts using Schedule Trigger Runs daily at 8 AM
- Fetch Market News
HTTP Request node calls: https://api.tradient.org/v1/api/market/news No authentication required (public API)
- Select & Limit News
Code node extracts: data.latest_news Limits to top 2 articles
You can change this limit in: return output.slice(0, 2);
- Normalize Data
Ensures consistent fields: news_object.title news_object.text stock_name
- Remove Duplicate News
Deduplicates using title Prevents repeated analysis
- Process One-by-One
Uses SplitInBatches Ensures controlled processing
- Rate Limiting
Wait node prevents API overuse Avoids hitting Gemini limits
- Generate AI Prompt
Creates structured prompt like: Title Content Expected JSON output
- AI Sentiment Analysis
Uses Gemini model: models/gemini-3.1-flash-lite-preview Returns: Sentiment Confidence Reason
- Parse AI Response
Removes markdown formatting Converts response into valid JSON Handles errors safely
- Calculate Impact Score
Formula logic:
Bullish → confidence × 1.2 Bearish → confidence × -1.2 Neutral → confidence × 0.3
- High Impact Filter
Conditions: Impact > 60 Impact < -60
- Email Alert Setup
You MUST configure:
Recipient email in Gmail node (sendTo)**
Example message:
Stock: XYZ Title: News title Sentiment: bullish Impact: 75 Reason: Strong earnings report
- Google Sheets Setup
Create a sheet with EXACT column names:
Title Stock Sentiment Reason
Important:
Column names must match exactly (case-sensitive) Do NOT rename fields Sheet must be connected in the node
How To Customize Nodes
Change Number of News Articles
Modify:
return output.slice(0, 2);
Adjust Impact Threshold
In IF node:
Change: > 60 < -60
Modify AI Prompt
Edit Generate Sentiment Prompt node to:
Add more context Include additional fields
Add More Sheet Columns
Update Google Sheets node mapping:
Add new fields like: confidence impact_score
Add-ons (Enhancements)
Slack/Telegram alerts instead of Gmail Dashboard (Power BI / Looker Studio) Store historical trends in database Add stock price correlation Multi-language news analysis Increase batch size with queue system
Use Case Examples
Daily Trading Signals Identify high-impact bullish/bearish news instantly
Portfolio Monitoring Track sentiment around owned stocks
Market Intelligence Systems Build automated research dashboards
Algo Trading Input Feed sentiment into trading algorithms
Financial News Aggregators Classify and rank news automatically
And many more custom use cases depending on your strategy.
Troubleshooting Guide
| Issue | Possible Cause | Solution | | ------------------------------ | ------------------------ | --------------------------------------------------- | | No data in Google Sheets | Incorrect column names | Ensure exact match: Title, Stock, Sentiment, Reason | | Emails not sending | Gmail not configured | Add credentials + recipient email | | AI response parsing error | Invalid JSON from Gemini | Check Parse node logs | | Duplicate news still appearing | Title mismatch | Improve deduplication logic | | Workflow not triggering | Schedule inactive | Activate workflow | | API returns empty data | API downtime | Test endpoint manually |
Need Help?
If you need help with:
Setting up this workflow Customizing AI prompts Adding dashboards or alerts Scaling automation systems Building advanced trading workflows
Reach out to our n8n workflow development experts at WeblineIndia for advanced assistance.
We can help you build production-grade automation tailored to your business needs.
Related Templates
Automatic News Summarization & Email Digest with GPT-4, NewsAPI and Gmail
📰 AI News Digest Agent: Auto News Summarizer & Email Newsletter Create an intelligent news curation system that automat...
Generate Food Recipes from Gmail & Form Requests with Ollama & Llama 3.2
This n8n template demonstrates how to create an intelligent food recipe assistant that accepts requests via Gmail and we...
Auto-classify Gmail emails with AI and apply labels for inbox organization
Who is this for? Professionals and individuals who receive high volumes of emails, those who want to automatically organ...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments