Skip to content

A machine learning project for predicting future trends in the S&P 500 index using historical stock data.

License

Notifications You must be signed in to change notification settings

snurdal/sp500-predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ˆ (S&P 500) Stock Market Prediction

This project uses historical data from the S&P 500 index to predict whether the market will go up the next day.

What does it do?

  • Fetches full historical S&P 500 data using the yfinance API
  • 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

๐Ÿ› ๏ธ Technologies

  • Python
  • pandas, yfinance
  • scikit-learn (RandomForestClassifier)
  • matplotlib (optional, for visualization)

๐Ÿ“ฅ Data Source

All data is pulled directly from Yahoo Finance using yfinance:

import yfinance as yf
sp500 = yf.Ticker("^GSPC").history(period="max")

About

A machine learning project for predicting future trends in the S&P 500 index using historical stock data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published