This project uses historical data from the S&P 500 index to predict whether the market will go up the next day.
- Fetches full historical S&P 500 data using the
yfinanceAPI - Creates new predictive features like:
- Moving average ratios
- Recent trend counts
- Trains a Random Forest Classifier to predict the next dayโs movement
- Returns both actual and predicted values for validation
- Python
- pandas, yfinance
- scikit-learn (RandomForestClassifier)
- matplotlib (optional, for visualization)
All data is pulled directly from Yahoo Finance using yfinance:
import yfinance as yf
sp500 = yf.Ticker("^GSPC").history(period="max")