Building an Automated Stock Scanner on AWS for Under $3/Month
Why Automate Stock Scanning?
Day trading small-cap momentum stocks requires finding the right setups before everyone else does. The window is narrow — premarket through the first 90 minutes of market open. Miss it, and the best moves are gone.
Manual scanning means staring at screens from 7 AM, flipping through tickers, checking volumes, reading news. It's exhausting and error-prone. The stocks that match all the criteria are rare — maybe 2-3 per day out of thousands.
We automated the entire process.
The Strategy We Implemented
The scanner implements a proven Small Cap Momentum methodology — a well-documented approach to small-cap momentum trading. Five criteria must align for a high-probability setup:
- Relative Volume at 5x or higher — confirms institutional interest
- Gap up 10%+ from previous close — shows momentum
- News catalyst — earnings, FDA approval, contract win — something driving the move
- Price $1–$20 — sweet spot for retail momentum
- Low float under 10M shares — limited supply means bigger moves
When all 5 align, the stock gets an A-grade. When 4 align, B-grade. Anything less gets filtered out.
The Architecture
Three Lambda functions, each with a specific job:
Gap Scanner fires at 7:00 AM EST. It scans all 15,000+ US-listed stocks, filters for stocks gapping up 10%+, checks relative volume, looks up float data, and checks for news catalysts via real-time news APIs. Scans the entire market in seconds.
Momentum Scanner runs at regular intervals from 7:15 AM to 10:00 AM. This catches stocks that weren't gapping premarket but start moving at the open — high-of-day breakouts, volume spikes, VWAP reclaims. It also re-scans gap stocks for continuation patterns.
Daily Summary compiles everything at 10:15 AM into a single Telegram message — all setups found, their grades, and key metrics.
DynamoDB tracks every alert with automatic TTL expiry. This prevents the same stock from triggering 10 alerts across 10 scan cycles. Once a ticker is alerted, it's marked as seen for the day.
The Telegram Alert Format
When the scanner finds an A-grade setup, the alert looks something like this:
A formatted message arrives on your phone within 1 second. It includes the ticker, current price, percentage change, relative volume, float size, and detected chart pattern.
No logging into a dashboard. No checking email. It just appears on your phone, ready to act on.
Why These Specific AWS Services?
Lambda over EC2: The scanner only runs for seconds per scan, a handful of times per day. An EC2 instance running 24/7 would be massively over-provisioned. Lambda scales to zero between scans — you only pay for what you use.
EventBridge over CloudWatch Events: EventBridge gives us precise cron scheduling with timezone-aware rules. The trading schedule is complex — premarket at one time, recurring momentum scans during market hours, summary at a specific offset. EventBridge handles this cleanly.
DynamoDB over RDS: The access pattern is simple — write an alert record, check if a ticker was already alerted today, query all alerts for the daily summary. DynamoDB handles this for pennies.
SSM Parameter Store over environment variables: API keys for Polygon, Polygon.io, and Telegram are stored in SSM and resolved at deploy time via SAM. No secrets in code, no secrets in environment variables visible in the Lambda console.
What We Learned Building This
Market data APIs are not all equal. We started with Yahoo Finance scraping. It broke twice in the first week — endpoint changes, rate limiting, inconsistent premarket data. Professional market data APIs with real-time news feeds provide the reliability a trading system needs.
News catalyst detection is the hardest criterion to automate. Volume, price, float — those are just numbers. But determining whether a stock has a "real" catalyst requires parsing news headlines and judging relevance. We use Polygon.io's news API and keyword matching. It's not perfect, but it catches 80% of catalysts. The remaining 20% are edge cases like sector rotation or social media momentum.
Deduplication is critical for sanity. Without the DynamoDB alert journal, the same stock would trigger alerts on every scan cycle as long as it met criteria. The dedup logic reduced noise by 90%.
Scan frequency is tuned to the strategy. The momentum strategy targets moves that develop over minutes, not seconds. The scan interval is calibrated to catch setups in time without overwhelming the trader with noise.
The 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. Commercial trading scanners charge $100-230/month for less flexibility and no customization.
Deployment
The entire infrastructure is defined in a SAM template. Push to main triggers GitHub Actions, which builds the Lambda packages and deploys via sam deploy. API keys are stored in SSM Parameter Store and referenced at deploy time.
New scanning criteria can be added by modifying the criteria checker module and pushing — the CI/CD pipeline handles the rest.
This system was designed and built by NG Solutions. Need automated monitoring, scanning, or alerting on AWS? Get in touch.