Stock watchlist threshold alerts in Slack

By General Input

Watch your tickers from a Google Sheet and get a Slack alert the moment any price crosses your upper or lower limit, every 15 minutes during US market hours.

Integrations

  • Real-Time Finance Data
  • Google Sheets
  • Slack Bot

Type

Deterministic Code

Categories

  • Finance
  • Personal Productivity

Build me a code workflow that watches a Google Sheets watchlist of stock tickers and posts a Slack alert any time a price crosses one of my preset thresholds. Pure deterministic plumbing, no judgement calls.

Trigger: cron every 15 minutes, Monday through Friday, between 9:30am and 4:00pm US Eastern time. Do not run on weekends or outside that window.

Inputs the workflow needs from me at setup: the Google Sheets spreadsheet ID, the watchlist tab name (default 'Watchlist'), the alert-history tab name (default 'AlertHistory'), the Slack channel ID to post to, and the cooldown in minutes (default 60).

Step 1. Use Google Sheets Get Values to read the watchlist tab. The sheet has a header row and these columns: Ticker, UpperLimit, LowerLimit, LastAlertedAt. Skip the header. For each row, parse UpperLimit and LowerLimit as numbers and LastAlertedAt as an ISO timestamp (may be blank).

Step 2. For each watchlist row, skip the ticker if LastAlertedAt is within the cooldown window (now minus cooldown minutes). Otherwise, call Real-Time Finance Data Get Stock Quote for that ticker and read the current price from the response.

Step 3. Compare the live price to the row's limits. If price is greater than or equal to UpperLimit, treat it as an upper-limit crossing. If price is less than or equal to LowerLimit, treat it as a lower-limit crossing. Otherwise, no alert for this ticker.

Step 4. For every crossing, use the Slack Bot Send a Message operation to post to the configured channel. Format the message as a single line like 'AAPL crossed upper limit: 198.40 vs 195.00' or 'TSLA crossed lower limit: 174.22 vs 180.00'. Include the ticker, direction, current price, and the threshold.

Step 5. For every crossing, use Google Sheets Append Values on the alert-history tab to append a row with: timestamp (ISO, UTC), ticker, direction ('upper' or 'lower'), price, threshold. This is the auditable log.

Step 6. After alerting for a ticker, also write the current timestamp back into that ticker's LastAlertedAt cell on the watchlist tab so the cooldown check on the next run works. Use a targeted range update on just that cell, not a rewrite of the whole sheet.

Error handling: if Get Stock Quote fails for one ticker (unknown symbol, rate limit, transient error), log it and continue with the remaining tickers. One bad ticker should not break the run.

Use the Slack Bot integration (xoxb token) for posting, not user-OAuth Slack, since these are automated alerts to a channel and should appear as a bot.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerA brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensStop cold emails to anyone with a live deal in PipedriveLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasoniMessage campaign console with pre-flight checks and delivery board