Templates / Track equity sector rotation with Google Sheets, Yahoo Finance, Groq and Gmail

Track equity sector rotation with Google Sheets, Yahoo Finance, Groq and Gmail

Ready for 3.0

by WeblineIndia ✓ · 340 views · created 2026-04-15 · Crypto Trading, AI Summarization

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

Nodes used (10)

Groq Chat ModelGoogle SheetsAI AgentGmail

What it does

Sector Rotation Tracker & Alert System of Equity Market This workflow automates the tracking of stock market sector rotation. It fetches a list of active stocks from Google Sheets, pulls their last 5 days of market data from Yahoo Finance and calculates momentum and sector strength using custom code. It then compares this current data against historical data to detect capital rotation signals. Finally, an AI Agent (powered by Groq's Llama-3 model) acts as a financial analyst to interpret the shifts and sends an automated Gmail alert if a high-confidence bullish trend is detected. Quick Implementation Steps Don't want to read the details? Follow these quick steps to get started: 1. Connect Credentials: Authenticate your Google Sheets, Gmail and Groq API accounts in n8n. 2. Setup Google Sheets: Create a Google Sheet with two tabs. "Sheet1" needs an active column set to true for stocks you want to track. "Sheet2" is used to store daily historic data. 3. Update Sector Map: Open the Group By Sector code node and update the sectorMap with your specific stock symbols and their corresponding sectors. 4. Configure Email: Open the Send Email Alert node and enter your destination email address. 5. Test and Run: Click "Test Workflow" to ensure data flows correctly, then activate it to run on your schedule! What It Does The Stock Sector Rotation Tracker acts as your personal automated quantitative analyst. It starts by pulling a predefined watchlist of active stocks from a connected Google Sheet. Using Yahoo Finance's API, it retrieves the daily closing prices and trading volumes over the past 5 days for each stock. Once the raw data is gathered, a series of custom JavaScript nodes process the information. It calculates 1-day, 3-day and 5-day returns, assigns momentum scores and evaluates volume ratios. The stocks are then grouped into their respective market sectors (e.g., IT, Banking, Auto) to calculate an aggregate "Sector Strength Score." This score is compared against historical data saved from previous days to determine if money is rotating into or out of a specific sector. To add a layer of human-like intelligence, the compiled data is sent to an AI Agent powered by Groq. The AI acts as an institutional equity researcher, providing a concise summary, explaining the possible reasons for the market movement and assigning a trading bias (Bullish, Bearish or Neutral) along with a confidence score out of 10. If the AI identifies a strong bullish signal, a detailed email alert is instantly dispatched via Gmail. Who It's For Retail Investors & Day Traders Looking for automated daily watchlists and momentum alerts without paying for expensive terminal subscriptions. Financial Analysts & Wealth Managers Needing an automated way to track institutional capital flows and sector rotation over time. Quant Enthusiasts Wanting a foundation to build custom algorithmic trading indicators using n8n and AI. Requirements to Use This Workflow To successfully run this workflow, you will need: An active n8n account (Cloud or Self-Hosted). A Google Account to access Google Sheets (for data storage) and Gmail (for sending alerts). A free Groq API key to power the Llama 3 AI model. A basic understanding of stock symbols (tickers) as used on Yahoo Finance (e.g., INFY.NS or AAPL). How It Works & Set Up Step 1: Prepare Your Google Sheets You need a Google Spreadsheet with two specific tabs. Tab 1 (Watchlist): Must include columns for stock symbols and an active column (set to true or false). Tab 2 (Historic Data): Must include columns for date, sector, sectorstrengthscore, trend, rotationsignal and scorechange. Step 2: Configure Credentials in n8n Google Sheets & Gmail: Set up OAuth2 credentials for your Google account. Connect these to the Google Sheets nodes and the final Gmail node. Groq API: Generate an API key from the Groq console and add it to the Insights from Model node. Step 3: Update Stock and Sector Mappings Open the Group By Sector code node. Modify

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.