Crypto Trading Backtesting: Scalable Backtesting Infrastructure for Cryptocurrencies
The Crypto Trading Backtesting project aims to provide a robust, large-scale trading data pipeline designed to help users backtest cryptocurrency trading strategies. The system uses historical candlestick data to simulate trades and evaluate strategies, providing valuable insights and reducing the risk associated with trading cryptocurrencies.
-
Data Ingestion : Fetches historical candlestick data from Binance and Yahoo Finance.
-
Backtesting Engine: Utilizes advanced frameworks like Backtrader, Freqtrade, and Vectorbt to simulate trades based on various strategies.
-
Metrics Calculation: Evaluates strategies using metrics such as returns, number of trades, winning trades, losing trades, max drawdown, and Sharpe ratio.
-
Dynamic Scene Generation: Automates backtesting runs with customizable parameters.
-
MLOps Integration: Incorporates tools like Apache Airflow, Kafka, MLflow, and CML for seamless pipeline automation and monitoring.
-
Frontend Interface: Provides a user-friendly interface for running backtests and viewing results.
-
Index Fund: Algorithm that shows the best backtested strategy and implements a recommendation based on a combination of best returns.
- Skills: Technical analysis, backtesting, trading, data pipeline building, structured streaming, workflow orchestration.
- Knowledge: Financial prediction, enterprise-grade data engineering using Apache and Databricks tools.
- Python Programming
- SQL Programming
- Data & Analytics Engineering
- MLOps
- Software Development Frameworks
crypto-trading-backtesting/
│
├── .github/
│ ├── workflows/
│ │ └── ci-cd.yml
│ └── ISSUE_TEMPLATE.md
│
├── airflow/
│ ├── dags/
│ │ ├── backtest_dag.py
│ │ └── monitor_dag.py
│ └── plugins/
│
├── app/
│ ├── __init__.py
│ ├── main.py
│ ├── models/
│ │ ├── backtest.py
│ │ └── user.py
│ ├── routes/
│ │ ├── auth.py
│ │ ├── backtest.py
│ │ └── index.py
│ ├── services/
│ │ ├── backtest_service.py
│ │ ├── kafka_service.py
│ │ └── mlflow_service.py
│ └── templates/
│ └── index.html
│
├── config/
│ ├── airflow.cfg
│ ├── config.py
│ ├── kafka-config.yaml
│ └── mlflow-config.yaml
│
├── docs/
│ ├── DESIGN.md
│ └── USAGE.md
│
├── notebooks/
│ ├── backtesting_yfinance.ipynb
│ ├── backtesting.ipynb
│ ├── Chronos.ipynb
│ ├── data_exploration.ipynb
│ └── model_training.ipynb
│ └── moirai_forcast.ipynb
│
├── scripts/
│ ├── backtest_runner.py
│ ├── data_ingestion.py
│ ├── forecast_backtest_runner.py
│ ├── forecast.py
│ ├── mlflow_backtest.py
│ └── model_training.py
│ └── moirai_forcast.py
│
├── tests/
│ ├── unit/
│ │ ├── test_backtest_service.py
│ │ ├── test_kafka_service.py
│ │ └── test_mlflow_service.py
│ ├── integration/
│ │ ├── test_end_to_end.py
│ └── conftest.py
│
├── .gitignore
├── docker-compose.yml
├── Dockerfile
├── requirements.txt
├── LICENSE
├── README.md
└── setup.py
-
Clone the repository:
git clone https://github.com/10-academy-w-9/crypto-trading-backtesting.git cd crypto-trading-backtesting
-
Set up a virtual environment:
python3 -m venv venv source venv/bin/activate #linux and Mac `venv\Scripts\activate` #On Windows
-
Install Requirements:
pip install -r requirements.txt
-
Configure environmnet variables and configurations:
.env app/config.py
-
Run backend api and mlflow server:
mlflow server --host 127.0.0.1 --port 5050 python run.py
-
Run frontend interface
cd frontend/ npm install npm run start
-
Run Chronos
pip install git+https://github.com/amazon-science/chronos-forecasting.git pip install pandas numpy torch sqlalchemy psycopg2-binary matplotlib chronos
- Run run_project.sh file:
sh run_prject.sh
-
Provide input descriptions of the trading strategies, including scenarios and expected outputs.
-
Run the backtesting system to simulate trades and evaluate strategies.
-
Review the generated metrics to assess the performance of different trading strategies.
-
Select the desired strategies for further use or real-time trading.
This project is licensed under the MIT License.
- @abyt101 - Abraham Teka
- @temesgen5335- Temesgen Gebreabzgi
- @SelamT94 - Selamawit Tibebu
- @derejehinsermu - Dereje Hinsermu