The cryptocurrency market poses several opportunities to exploit arbitrages. While statistical arbitrage in the stock market is applied to various equities based on classic cointegration-based pairs trading strategy, the same concept can be applied to a crypto-currency that shares different closing prices in two different exchanges. This simple code serves to show how this opportunity can be taken advantage of.
Jupyter Notebook through the installation of Anaconda.
The code is carried out on Jupyter Notebook using Python 3.6. Most libraries imported in this code comes together with Anaconda.
- We first develop an API connection with Cryptocompare using Python package, Beautiful Soup, to extract the necessary information on Ether sold over different exchanges.
- Retrieve prices & volumes (traded in the last 24 hours) of ETH in different exchanges
- Price Time-series of ETH in the different exchanges
- Measure the average difference & standard deviation
- Identify 2 exchanges with greatest average difference in prices & least standard deviation
- Backtesting algo trading using statistical arbitrage for ETH/USD
- After the current trade, a new one is opened immediately at the same prices;
- There is no slipage assumed;
- The short selling is available on both markets;
- There is no commission fee structure incorporated into trades;
- The margin calls are ignored.