INSPIRATION
Viraj is a woke person of the digital era, he relies on his smartphone’s voice assistant for a majority of his tasks. He is a marvelous trader. As a tech junkie, he relies on tech and automation for a majority of tasks and desires to make his trading decisions do the same. Although there is a major setback in this story, he is not much affluent with the core technical aspects required to make such a system. Hence, he asks his techie friends Shubham and Shantanu to lend him a helping hand. Thus, these three friends embark on a journey to create an automated trading system. The aim is to develop a dynamic system that allows room for changes and at the same time is capable to faciliate complex trading strategies. The plan also harnesses Machine Learning models to predict market movements more accurately.
RESULTS
High Level Architecture (Workflow)
Code 🧑💻
- Problem Definition - The goal is to create two machine learning-based trading systems -
MLBacktester
andStockPredictor
- that can backtest trading strategies and predict stock prices, respectively.
- Data Collection - Data has been collected needed for the project. The
yfinance
library was used to obtain historical stock prices data.
- Data Cleaning - Data cleaning was performed to ensure that the data is in an appropriate format for analysis. This step included removing duplicates, filling in missing values, and detecting and removing outliers.
- Feature Engineering - New features were created from the existing data to improve the performance of the models. This step included calculating technical indicators such as moving averages, Bollinger Bands, and Relative Strength Index (RSI) using the
pandas
library.
- Model Development - The models were developed using appropriate machine learning algorithms. In this case, the
MLBacktester
class used a classification algorithm to predict the buy/sell signals, and theStockPredictor
class used a regression algorithm to predict the stock prices. Thescikit-learn
library was used for this step.
- Model Evaluation - The performance of the models were evaluated using appropriate metrics. The
scikit-learn
library was also used for this step.
- Model Optimization - The models were optimized by tuning the hyperparameters, feature selection, and model selection.
- Deployment - The models were deployed in production, integrated with other systems, and maintained over time. For deployment, Azure Web App Service and CI/CD pipeline were used to automate the workflow. The trades were also linked with FXCM API to carry out the trades automatically. Finally, the performance of the models were monitored and updates were made as needed to maintain their accuracy and effectiveness.
- Documentation - The project was documented to communicate the project's findings, methods, and results effectively. This step included writing a README file, documenting the code using appropriate comments and docstrings, and creating a project report or presentation. A README file was created for the Automated Trading Systems GitHub repository using the template provided earlier.