Skip to content

Machine Learning Algorithm To Predict Stock Direction

Notifications You must be signed in to change notification settings

jbamford/stock_surface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stock Surface - Machine Learning Algorithm To Predict Stock Direction

This module was motivated by a unique feature set I wanted to test.

Installation

git clone [repository] 

Running Code

cd stock_surface

#install the dependencies 
pip install -r /path/to/requirements.txt

#runing tests
pytest tests/

#get stock data and train a new model
python get_tickers.py

#look at how well model did for individual stock
pytest tests/test_plotting.py::test_plot_stock 

#check returns for whole portfolio 
pytest tests/test_backtest.py::test_on_array_of_tickers_profit

#open the csv file 
vi files/testing_files/return_output.csv

Useful Files

get_tickers.py

This file holds the main function that pulls the stock data, manipulates the feature set, and trains the model.

sample_slopes.py

This file holds the functions to perform the feature and target value manipulation on the stock data.

settings.py

Holds the settings for the back testing

support_vector.py_

This holds the class that's used for ML

plotly_web.py

Used for making a pretty 3D surface graph on Plotly

tests/test_plotting.py Used for inputting a stock ticker and having it make a graph of the algorithm's returns alongside the close prices and trade indicators.

tests/test_back_test.py

These functions are used to test how well your model did on the market data most notably: test_on_array_of_tickers_profit()

This will output a CSV file that you can compare how each stock did to just holding it.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

About

Machine Learning Algorithm To Predict Stock Direction

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages