Project
Stock Signals Tracker
Serverless system that detects buy and sell signals on stocks listed on the Mexican Stock Exchange.
View on GitHub →Goal
A serverless AWS system that tracks daily stock prices from the Mexican Stock Exchange (BMV) and the International Quotation System (SIC). It applies technical analysis indicators — Bollinger Bands and RSI — to automatically detect buy and sell signals. The system does not execute orders: it observes, calculates, and records to support informed decision-making.
How it works
- Daily price fetchMonday–Friday at 16:30 CDMX, Windows Task Scheduler runs a local Python script that downloads OHLCV prices from Yahoo Finance (yfinance). Local execution is required because Yahoo Finance blocks AWS Lambda IP ranges.
- USD/MXN exchange rateThe same script fetches the day's exchange rate from the Frankfurter API (ECB) and computes the MXN price for USD-denominated stocks.
- Persistence in DynamoDB and S3Prices and exchange rates are stored in DynamoDB and in Parquet files partitioned by market and date in S3.
- Event-driven analysis via StreamsEach write to the prices table triggers a DynamoDB Stream that automatically invokes the analyze-signals Lambda.
- Technical indicator calculationThe Lambda queries the last 90 days of price history, calculates Bollinger Bands (20-day) and RSI (14-period) using pandas, and classifies each ticker as BUY, SELL, or HOLD.
- Signal storageSignals are persisted to DynamoDB and S3, queryable via Amazon Athena with the Glue catalog.
Daily scheduling
The price fetch runs at 16:30 CDMX (Monday–Friday) from Windows Task Scheduler. Signal analysis is fully event-driven via DynamoDB Streams — no polling, no additional scheduler on AWS. If the machine was off at 16:30, the task runs as soon as the network is available.
AWS Services
- DynamoDB3 on-demand tables with Streams (prices, signals, exchange rates)
- Lambda3 functions (fetch, analyze, backfill) + 1 Python layer with pandas and pyarrow
- S3Parquet storage partitioned by market and date
- AWS GlueData catalog for Athena
- Amazon AthenaSQL queries over historical data in S3
- SSM Parameter StoreConfiguration for tickers and technical indicators
- EventBridgeDisabled cron rule; daily fetch uses local Task Scheduler instead
- CloudWatch LogsLambda execution monitoring
- IAMLeast-privilege policies per function
- CloudFormation / CDK4 infrastructure-as-code stacks in TypeScript
External Services
- Frankfurter (ECB)Daily USD/MXN exchange rate. Free, no API key required.
- Yahoo Finance (yfinance)Free OHLCV historical prices. Executed from a residential IP to bypass the block Yahoo Finance applies to AWS IP ranges.
Stack