The Gate.io Surprise

Photo by Shubham Dhage on Unsplash

Greetings, everyone! Recently we started to work on Gate.io’s integration into our lightning-fast library https://github.com/crypto-chassis/ccapi. Did you notice that there is an important problem with Gate.io’s market data feed? Yeah, seriously there is a jaw-dropping problem! If your algorithm relies on the trade direction field in their trades API, then there is a good chance that you’ve been screwed up. For a given trade, the trade direction reported by their WebSocket API is exactly the opposite of the value reported by their REST API.

WebSocket:

Trade direction for trade id 1763687923 reported by WebSocket API

REST:

Trade direction for trade id 1763687923 reported by REST API

We pay attention to the smallest details as we develop our trading library https://github.com/crypto-chassis/ccapi and our market data archive https://github.com/crypto-chassis/cryptochassis-data-api-docs because we do perform trading using our own library and data with private capital and any mistakes directly have an impact on ourselves. In two of our previous articles entitled “Leveraging Trade Directions” and “The Nitty-Gritty of Paper Trading a Market Making Strategy”, we discussed the importance of trade directions. After thorough investigation on Gate.io’s API documentation, we were unable to find out why the reported trade directions are opposite. The only explanation is that one API reports the maker side and the other API reports the taker side. Without clear documentations, how do we know which is which? Let’s look at their web trading interface:

Trade direction for trade id 1763687923 reported by web trading interface

Tada! It’s obvious that this trade originated from a maker-buy order previously sitting on the order book at a price level of $54653.29. In our API the field called “is_buyer_maker” thus is unambiguously assigned a true value for this trade. And you don’t have to worry about whether the underlying code uses the exchange’s WebSocket API or REST API.

If you are interested in our work or collaborating with us, join us on Discord: https://discord.gg/b5EKcp9s8T 🎉 We specialize in market data collection, high speed trading system, infrastructure optimization, and proprietary market making. You’re welcome to hire us as engineers, liquidity providers, traders, or asset managers.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store