← Architectures

Automated Trading Scanner Bot

Serverless stock scanner implementing a proven Small Cap Momentum strategy. Scans US premarket and morning sessions for high-probability setups, scores them A through F, and sends instant Telegram alerts.

Category
Automation
Region
us-east-1
Tags
7 services
Automated Trading Scanner Bot
LambdaEventBridgeDynamoDBSAMPolygon.ioTelegramCloudWatch

Overview

A fully automated stock scanning system that implements a proven Small Cap Momentum strategy for small-cap momentum stocks. The bot runs on AWS Lambda, scanning the US market during premarket and morning sessions, scoring each setup against 5 strict criteria, and delivering instant alerts to Telegram with full technical analysis.

The system operates Monday through Friday on the US market schedule, scanning the entire US market (15,000+ stocks) multiple times per trading day from premarket through the first 90 minutes of market open — the highest-probability window for momentum trades.

The Strategy

The scanner implements a proven 5 core criteria for small-cap momentum trading. All 5 must be met for an A-Grade setup:

#CriterionRequirement
1Relative Volume5x or higher above 30-day average
2% Change Today+10% or more from previous close
3News CatalystBreaking news driving the price action
4Price Range$1.00 – $20.00 (sweet spot: $5–$10)
5FloatUnder 10M shares (cold market) / under 20M (hot market)

Setups are scored A through F based on how many criteria are met and the strength of each signal. Only A and B grade setups trigger alerts.

Architecture

The system uses three Lambda functions orchestrated by EventBridge scheduled rules, with DynamoDB for alert journaling and deduplication.

Gap Scanner (Premarket)

Runs at 7:00 AM EST. Scans all 15,000+ US-listed stocks for premarket gaps, filters by the 5 criteria, checks for news catalysts via real-time news APIs, and scores each candidate. Qualified setups are stored in DynamoDB and sent to Telegram immediately.

Momentum Scanner (Market Hours)

Runs at regular intervals during market hours — the highest-volume period for small-cap momentum. Detects high-of-day breakouts, volume spikes, and continuation patterns. Each scan checks against DynamoDB to avoid duplicate alerts on the same ticker.

Technical analysis includes:

  • Pattern detection: Bull flags, flat-top breakouts, VWAP reclaims
  • Volume analysis: Relative volume, volume-weighted moves
  • Key levels: Support/resistance, premarket high, previous day close

Daily Summary

Runs at 10:15 AM EST after the final scan. Compiles all setups found during the session into a single Telegram message with performance grades and key metrics.

AWS Services

ServicePurpose
Lambda (Python 3.11)3 functions: gap scanner, momentum scanner, daily summary
EventBridge16 scheduled rules across the trading window
DynamoDBAlert journal with TTL — tracks all setups, prevents duplicates
SSM Parameter StoreSecure storage for API keys (Polygon.io, Telegram)
SAMInfrastructure as Code, GitHub Actions CI/CD
CloudWatchError alarms, execution monitoring

External Services

ServicePurpose
Polygon.ioReal-time and historical market data, premarket quotes
Multiple news APIsReal-time news catalyst detection and sentiment analysis
Telegram Bot APIInstant alert delivery to mobile

Scanning Schedule

Time (EST)ScannerAction
7:00 AMGap ScannerPremarket gaps + news catalyst check
7:15 – 9:45 AMMomentum ScannerHOD breaks, volume spikes (recurring)
10:00 AMMomentum ScannerFinal scan
10:15 AMDaily SummaryRecap of all setups found

Scoring System

Each stock is scored across multiple dimensions:

  • Criteria score: How many of the 5 core criteria are met (weighted)
  • Technical score: Pattern quality, volume confirmation, key level proximity
  • Overall grade: A (strong), B (good), C (watchlist), F (fail)

The Telegram alert includes the grade, all criteria values, and detected patterns.

Cost

The AWS infrastructure cost is under $3/month — Lambda, DynamoDB, EventBridge, and CloudWatch combined. Plus a market data API subscription for real-time quotes and news.

Key Design Decisions

Polygon.io over Yahoo Finance: Yahoo Finance scraping breaks constantly and has no SLA. Polygon.io provides a proper API with live market data, websocket support, historical data, and premarket quotes. Reliability is non-negotiable for a trading system.

Optimized scan frequency: Scan intervals are tuned to balance API rate limits, alert quality, and the strategy's timeframe. Frequent enough to catch setups, sparse enough to avoid noise.

DynamoDB for deduplication: Without it, the same stock would trigger alerts on every scan cycle. The alert journal tracks seen tickers with TTL auto-expiry, so yesterday's alerts don't interfere with today's scans.

Telegram over email: Day trading alerts need to be instant and mobile-first. Telegram delivers in under 1 second with rich formatting, images, and no spam folder risk.

Results

  • Multiple automated scans per trading day
  • Sub-second alert delivery via Telegram
  • A/B grade filtering eliminates noise — only high-conviction setups reach the trader
  • Under $3/month AWS infrastructure cost
  • Zero manual scanning — the bot watches the market so you don't have to