These are ML and NN methods ready to launch out of the box. Designed to be easy for those looking to learn new techniques for stock prediction. These examples are meant to be simple to understand and highlight the essential components of each method. Examples also show how to run the models on current data in order to get stock predictions.
- Genetic algorithms
- Gradient boost
- K-means clustering
- Logistic regression
- Random Forest
- Support vector machines (SVM)
- Feed-forward neural networks (FFNN)
- Long short-term memory (LSTM)
- Recurrent Neural Networks (RNN)
- Keras
- Lightning
- PyTorch
- Tensorflow
- Clone this repository.
- Navigate to the project directory.
- Install the necessary libraries:
pip install -r requirements.txt
-
Download the starter data:
- These examples require precisely formatted stock data with the following properties:
- Windowed: Time series is segmented into regular windows.
- Boolean labels: Rather than predicting specific values at specific times, the data is classified.
- Test/Train split: Split chronologically for no data overlaps and look-ahead bias.
- Download the starter data. and save the
example_data
directory to this project folder.
- These examples require precisely formatted stock data with the following properties:
-
Run any of the scripts in
simple_examples
.
Designed for easy configuration of what hyperparameter values are explored. Multi-threaded processing for quick runtimes.
- Code is in
hyperparameter_tuning
- Edit
config.py
to suit your needs - Run
hyper_main.py
Hyperparameter readme here: Hyperparameter Tuning
This code can be run with the example stock data available at D.AT example data.
This dataset encapsulates 5 years of price data of the companies comprising the S&P 500, segmented into intervals of 30 trading days each. The data in each segment has been normalized using a method where values are divided by the most recent data point within the segment. Each row in the dataset represents a specific segment, providing a snapshot of the stock data available on a particular trading day. Rows are labeled to indicate when the stock had a minimum gain of 5% within the subsequent 10 trading days.
train.csv
: Of the 5 years, it contains the first 4 years of data.test.csv
: Of the 5 years, it contains the final year of data.latest.csv
: This file contains data from the most recent trading day for all stocks listed. While it lacks labels (since these pertain to future events), each row maintains the same feature vector structure as those in thetrain
andtest
files. The rows commence with the stock ticker symbol, serving as a key tool to pinpoint stocks with promising prospects for good performance.
The example data is static and does not contain current stock price values. Recent data customizable with different trading strategies and feature engineering options can be downloaded for free at D.AT.