This workflow automates sentiment analysis on stock-related news articles.
- Fetches live news from NewsAPI based on stock symbols in a Google Sheet
- Uses Gemini AI to classify sentiment and assign a confidence score
- Applies a weighted average based on article recency and article count
- Appends the sentiment scores and explanations back to the spreadsheet
- n8n (self-hosted or cloud)
- Google Sheets
- NewsAPI (via HTTP request)
- Gemini AI
- Create two Google Sheets
- Sheet 1: Metrics Summary
- Contains symbols and their calculated metrics (weighted score, count, etc.)
- Example columns:
Symbol,Weighted Avg Score,Article Count,Total Weight,Last Updated
- Sheet 2: Raw News Sentiment Log
- Logs individual article-level insights
- Example columns:
symbol,sentiment,score,explanation,publishedAt
- Sheet 1: Metrics Summary
- API Keys
- API keys for NewsAPI and Gemini API (Google AI) are needed.
- Ensure the keys are set up in n8n using credentials, environment variables, or injected manually in a secure way.
- Set up n8n credentials for Google Sheets, HTTP, and Gemini.
- Import the workflow JSON into n8n.
- Run or schedule it to execute daily.