Optimal Buy/Sell Windows on Low-Vol Crypto Exchanges

A programatic approach for finding the best times to buy and sell crypto on low-volume exchanges. Market inefficiencies are identified by comparing to average prices across all exchanges, revealing optimal trade windows on the low-volume exchange of interest.

Image for post
Some pretty charts.. read on for more details!

Code is provided by way of a Jupyter Notebook. The CryptoCompare API is used to pull market data. In this post I share results for the CAD exchange QuadrigaCX, but I encourage you to fork the code from GitHub, and plug in your exchange instead.

The Algorithm

We’ll search for market inefficiencies by looking at the so-called price delta: the difference between average USD price and the price on the exchange. Here is the formula:

price_delta = exchange_price - average_price

The interpretation, therefore, is to sell when price_delta is high and buy when price_delta is low.

Note — since the exchange we’re looking at trades in CAD, there’s an added step for converting the average price from USD to CAD. This has been automated with an API that gets historical exchange rates.

Results for QuadrigaCX

Here are my results for https://www.quadrigacx.com/, where we look at Bitcoin, Ethereum and Litecoin.

Here is the price chart that you’re probably familiar with, this includes data from September to December 2017:

Image for post

The price deltas for this time-frame are as follows:

Image for post

To understand this chart, look back to the definition of price delta. Simply put, we can think to sell when price_delta is high and buy when price_delta is low.

This is skewed in the sense that we find high variance on the right, an effect of the price increase which can be controlled for by normalizing the y-axis, as seen below:

Image for post

This shows how recent price action has led to increased market inefficiencies.

Filtering on data from the last 30 days (Nov 20 — Dec 20, 2017), let’s see how price_delta is related to

  • day of week
  • hour of day

Bitcoin (XBT-CAD)

Buy from Fri-Sun and sell from Tues — Thurs.

Image for post

Buy around midnight and sell around noon.

Image for post
Using 24 hour clock in PST.

Ethereum (ETH-CAD)

Buy on Mon or Fri and sell from Tues — Thurs.

Image for post

Buy in the evening and sell during the morning and early afternoon.

Image for post
Using 24 hour clock in PST.

Litecoin (LTC-CAD)

Buy on the weekend and sell from Tues — Thurs.

Image for post

Sell during the morning and early afternoon.

Image for post

Conclusion

We’ve looked at the market inefficiencies for a low-volume CAD exchange, and provided data-driven suggestions on optimal trade windows to experiment with. Overall, the data shows buying opportunity on/near weekends and late at night, and selling opportunity during working hours.

This may be useful as a guide, but really the best way to assess the current market inefficiency is by running the code right now to calculate the live price_delta up to the last hour. For example, here is the current trend for each coin (over the last three days):

Image for post
Image for post
Image for post

As can be seen, there were some good selling opportunities on Dec 19th in the early morning hours, but now the CAD market is trending quite close with the USD average equivalent.

I put some effort towards making the code reliable, clean and easy to read. I really would love for you to fork the code and try the same analysis for a different exchange. If you need help along the way and/or find results worth sharing, let me know on Twitter @agalea91.

Here’s another link to the code:

Thanks for reading!

Written by

Python Data Engineer, MSc. Physics