workflows.fit
Back to n8n workflows
n8n templateFreeBy WeblineIndia

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

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 da...

Data & StorageProductivityDevelopmentCore NodesCommunicationHITLAILangchain
Loading interactive preview...

Template notes

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.