This repository contains the implementation of a trading bot for financial markets, leveraging machine learning techniques and the MLflow platform to manage the entire machine learning lifecycle. The project includes data preprocessing, training, validation, and backtesting of trading strategies using a custom TradingBot class and various financial indicators. The integration with MLflow allows for comprehensive experiment tracking, model management, and performance monitoring.
• Financial Data Handling: Preprocessing and managing financial data with custom indicators and features.
• TradingBot: Implementation of a reinforcement learning-based trading bot.
• Training & Validation: Scripts to train and validate the trading bot using historical data.
• Backtesting: Both vectorized and event-based backtesting methods to evaluate trading strategies.
• MLflow Integration: Comprehensive experiment tracking, model logging, and performance metrics with MLflow.
• Visualization: Plotting tools to visualize trading performance and financial indicators.
git clone https://github.com/yourusername/TradingBot-MLflow.git cd TradingBot-MLflow
Ensure you have Python 3.9 or later. Install the required Python packages: pip install -r requirements.txt
If you don’t have an MLflow server running, you can start one locally: mlflow server --backend-store-uri sqlite:///mlflow.db --default-artifact-root ./mlruns --host 0.0.0.0 --port 5000
1. Prepare Financial Data:
Ensure you have the financial data required for training. The data should be in the format expected by the Finance class.
2. Train and Validate the Trading Bot:
Run the training script to train and validate the trading bot. This script logs parameters, metrics, and the trained model using MLflow.
python train.py
- Backtest the Trading Bot: Use the backtesting scripts to evaluate the performance of your trading strategies on unseen data. python backtest.py
4. Visualize Results:
The scripts include plotting functions to visualize the performance of the trading bot and various financial indicators.
TradingBot-MLflow/ ├── data/ # Directory to store financial data
├── finance.py # Module for financial data handling and feature engineering
├── tradingbot.py # TradingBot class and related functions ├── train.py # Main script for training the trading bot
├── requirements.txt # Required Python packages
└── README.md # Project description and usage instructions
Contributions are welcome! Please create a pull request or open an issue to discuss any changes or improvements.
This project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries or support, please contact Oscar Rangel at [email protected]