This project aims to develop a statistical arbitrage strategy for cryptocurrencies using Python. The primary goal is to leverage mean-reversion trading and portfolio optimization techniques to generate alpha and minimize risk in cryptocurrency trading. The project involves:
- Retrieving Historical Price Data: Collecting data for Bitcoin (BTC) and Ethereum (ETH) from the CoinGecko API.
- Data Manipulation: Using the pandas library to process and analyze the data.
- Trading Strategy Implementation: Executing trades based on calculated daily returns.
- Portfolio Optimization: Employing functions to balance risk and return.
- Results Visualization: Plotting and saving the outcomes in the
results
directory. - The project can be expanded by incorporating additional cryptocurrencies or adopting more advanced trading strategies.
The project can be expanded by incorporating additional cryptocurrencies or adopting more advanced trading strategies.
We will use historical price data for Bitcoin (BTC) and Ethereum (ETH) obtained from the CoinGecko API. We will use the requests
library to make API requests and the pandas
library to manipulate the data.
This project requires Python 3.7 or later.
- Clone the repository:
git clone https://github.com/notabombe/statistical-arbitrage-cryptocurrencies.git
- Navigate to the project directory:
cd statistical-arbitrage-cryptocurrencies
- Install Dependencies:
pip install -r requirements.txt
- Open the
config.py
file and enter your CoinGecko API key:
COINGECKO_API_KEY = "your-api-key"
- Run the
main.py
file:
python main.py
This will retrieve the price data, calculate the daily returns, and execute the statistical arbitrage strategy. The results will be plotted and saved in the results
directory.
config.py
: Configuration file for the project.data.py
: Data retrieval and manipulation functions.portfolio.py
: Portfolio optimization functions.trading.py
: Trading strategy functions.main.py
: Main script to run the project.results/
: Directory to store the results of the project.
This project is licensed under the terms of the MIT license. See the LICENSE file for details.
This project demonstrates how to develop a statistical arbitrage strategy for cryptocurrencies using Python. By combining mean-reversion trading and portfolio optimization, we were able to generate alpha and minimize risk. This project can be extended by adding more cryptocurrencies to the portfolio or by using more sophisticated trading strategies.