An automated quantitative trading system designed to backtest, analyze, and predict intraday price behavior of the SPDR S&P 500 ETF Trust (SPY) around key technical levels.
This project extracts historical tick data, engineers structural market features (PM/AH levels, ORB, Previous Day levels), and trains an ensemble machine learning model to classify whether a touch of a key level will result in a Rejection (bounce), a Breakout, or remain Unclear.
- Automated Data Pipeline: Fetches 1m and 5m interval data using
yfinanceto reconstruct daily sessions and key market levels. - Event Extractor: Identifies exact timestamps where price interacts with key levels and calculates the subsequent forward-path trajectory.
- Feature Engineering: Generates time-based, volume-based (RVOL), and price-momentum features for ML processing.
- Machine Learning Classifier: Evaluates Random Forest, XGBoost, and Gradient Boosting to classify level interactions.
- Live Market Scanner: Monitors recent intraday data to provide real-time probability signals for upcoming level touches.
Visualizes the historical trajectory of SPY after interacting with specific levels (e.g., pre-market highs, opening range breakouts).
Performance metrics across our tested ensemble models, including 5-Fold Cross-Validation accuracy and the Random Forest confusion matrix.
- Clone the repository:
git clone [https://github.com/YourUsername/spy-key-level-behavior.git](https://github.com/YourUsername/spy-key-level-behavior.git) cd spy-key-level-behavior