Bid-Ask Spreads

Crypto Chassis
Open Crypto Trading Initiative
2 min readSep 24, 2020

The difference between the bid quote and the ask quote at any given time is known as the bid-ask spread. Most low-frequency price changes are large enough to make the bid-ask spread negligible in comparison. In tick data, on the other hand, incremental price changes can be comparable or smaller than the bid-ask spread. Bid-ask spreads usually vary from time to time. Today we are going to show you an ultra-easy way to obtain and visualize bid-ask spreads data for crypto.

We love coinbase and BTC/USD, so go to https://api.cryptochassis.com/v1/market-depth/coinbase/btc-usd?depth=1&startTime=1600732800, click on the signed url in the response, and unzip the downloaded file. The data that we obtained this way are a standard csv file and look like this:

time_seconds,bid_price_bid_size,ask_price_ask_size
1600732800,10416.82_4.38009963,10416.83_6.559
1600732801,10418_4.83882435,10418.01_0.99840785
...

It is self-explanatory that the first row means that at unix timestamp 1600732800 (i.e. 2020–09–22T00:00:00) the bid price is 10416.82, the bid size is 4.38009963, the ask price is 10416.83, and the ask size is 6.559. Thus the bid-ask spread is 10416.83–10416.82=0.01. Wow, plot these numbers against their timestamps is super easy:

Coinbase BTC/USD bid-ask spread
Coinbase BTC/USD bid-ask spread

Here only the first minute of 2020–09–22 instead of the whole day was plotted to avoid too many data points. The interesting observation is that there are many spikes present in the plot (such as those highlighted by red stars) implying a dramatic increase in the bid-ask spread within 1 second immediately followed by a dramatic decrease. This represents a good opportunity for market makers and arbitragers, and this isn’t an accidental discovery. If you download the data sets for other periods of time, other trading pairs, or other exchanges, you’ll find out that these spikes are ubiquitous, meaning these opportunities are ubiquitous. In order to convert opportunity into profitability with confidence, you want to do the following three things:

  1. Solidly backtest your strategy using a high-frequency data set: our market depth data set and trade data set (which we’ll talk about in another article) are perfect for this purpose: https://github.com/crypto-chassis/cryptochassis-api-docs.
  2. Have lightning-fast real-time market data feed so that you can detect these opportunities before others do: our open-source C++ market data engine is perfect for this purpose: https://github.com/crypto-chassis/ccapi_cpp. Notice that it doesn’t connect to our server, instead it directly connects to the exchange servers. This also happens to be the exact codebase that we used to collect those market data sets that you just downloaded.
  3. Have lightning-fast order execution engine. Currently we don’t have one. But if you do and would like to become our partners, let us know. 😄

Feel free to contact us at hello@cryptochassis.com for general questions, issue reporting, consultative services, and/or custom engineering work. To subscribe to our mailing list, simply send us an email with subject “subscribe”.

--

--