Skip to content

Machine learning trading bot to inform decisions about investment returns based on different trading strategies.

Notifications You must be signed in to change notification settings

kyhuber/ML-Trading-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ML_Trading_Bot

Creating a machine learning trading bot to inform decisions about returns based on different trading strategies.

First, the ML Trading Bot establishes a baseline performance from stock performance data contained within a csv file. Moving average values are calculated based on predefined inputs and creating trading signals. Next, the bot tunes the baseline trading algorithm using the support vector machine learning method. The app plots actual returns and strategy returns based on trading signals derived from the SVMLM.

Finally, the app reconsiders stock performance data using the LogisticRegression ML model.

The ML Trading Bot creates value for users, namely investors, by creating performance predictions. The bot can be tuned using any ML model and tested to view outcomes based on historical data.

The app ML analysis to performance data from any publicly traded asset.


Technologies

The ML Trading Bot is written in Python 3.10.1 using Jupyter Lab. It is compatible with Mac and PC OS. The tool uses the Pandas libraries to collect, prepare, and analyze the data. Data visualization plots are rendered using hvplot. Machine Learning libraries come from SK Learn

This app references raw data that is provided in a CSV file.


Installation Guide

This app can be run in Gitbash or Terminal. The app and supporting files are located in the below Github repository: https://github.com/kyhuber/ML_Trading_Bot/


Findings

Long SMA = 100, Short SMA = 4, Training Window = 3 months

These parameters establish a baseline for performance data. We can see that the strategy returns slightly exceed the actual returns using the SVC classifier model. The strategy returns exhibit similar volatility and trend lines.

image

What impact resulted from increasing or decreasing the training window?

Long SMA = 100, Short SMA = 4, Training Window = 24 months

By increasing the training window, the strategy returns improves significantly.

image

What impact resulted from increasing or decreasing either or both of the SMA windows?

Long SMA = 30, Short SMA = 1, Training Window = 3 months

By decreasing the long window to 30 and short to 1, we see good strategy returns but the trend line is more volatile.

image

Logistic Regression Model

Long SMA = 100, Short SMA = 4, Training Window = 3 months

The strategy returns and actual returns are more consistent using the logistic regression model, but they are not as favorable as the SVC model.

image

Maximum Returns

Long SMA = 100, Short SMA = 1, Training Window = 24 months

By decreasing the short window, we see a sizable improvement of strategy returns in the SVC model. This combination of a longer long window, a shorter short window, and longer training window creates the best returns.

image


Contributors

The ML Trading Bot was written by Kyle Huber in April 2022.


ML_Trading_Bot

About

Machine learning trading bot to inform decisions about investment returns based on different trading strategies.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published