Skip to content

Latest commit

 

History

History
72 lines (51 loc) · 3.73 KB

README.md

File metadata and controls

72 lines (51 loc) · 3.73 KB

Stock Advizir

This app uses a machine learning model to infer if a user should buy, sell, or hold a stock.

Data

The data was gathered from Yahoo Finance, Organisation for Economic Co-operation and Development, and Financial Modeling Prep

Data was gathered for 3 stocks per sector per market cap size. This results in a total of 9 stocks per sector, 3 small, 3 mid, 3 large.
There are 15 total sectors for a total of 9 * 15 ~ 135 stocks that data was gathered for and models trained on. (Some stocks in the list to train on were not on yahoo finance, and I didn't feel like fixing it. Worst case, you vote with 2 classifiers.)

The data was cleaned and ratings of 'buy', 'mega buy', 'sell', 'mega sell', and 'hold' were added to the historic data for the model to be trained on.

The following indicators were also added for each stock to the historic data: RSI, MACD, Stochastic Oscillator, & Volume Zone Oscillator.

The Consumer Confidence Index was also added to the historic data, but is not specific to any stock.

Example Data:

Training Data Example 1 Example 2 Example 3

Training

The indicators above are what the model is trained on. Volume, and price are not used for training, just the oscillators that are calculated based on price and volume because they are easily normalized.

The accuracy of the models was around the high 60s, lots in the 70s, some in the 80s and 90s and one outlier at 100% accurate legitimately.

The algorithm used currently is the Scikit Learn Random Forest Classifier.

Example Confusion Matrices:

Confusion Matrices
Example 1 Example 2

Prediction

The stock data is gathered and cleaned the same as during training. Indicators are added as well.

The models for the stocks sector and market cap size are loaded.

The prediction for each day is a result of majority voting, which is why we chose an odd number of stocks per sector.

Example Predictions:

Predictions Example 1 Example 2 Example 3

Android App

Currently in development: Download on Google Play Store
Play Store Page

Backtesting

Backtesting results: positions are here and the list of trades here. The starting balance is 100k for each stock. The profit over 10 years is 245% not including dividends. Starting balance of $3.2m, ending balance of $7.8m.

Credit

Thanks to the developers of FinTa and YFinance for their useful tools that are used in this program.

License

GPL-3.0-or-later