The Private Information Edge: An Interesting Tale in High Frequency Trading

Crypto Chassis
Open Crypto Trading Initiative
5 min readMay 3, 2023
Photo by Markus Winkler on Unsplash

Greetings, Ladies and Gentlemen! Hope that your investments were doing well during this uncertain period of time. We haven’t written on medium for a while because we haven’t found another interesting area to write about, not until recently. But we are back here and plan to write a few articles related to the asynchronous nature of high frequency trading (HFT). In particular, we will present some in-depth thoughts and have some in-depth discussions on how the asynchrony might lead to gain or loss of information edge.

In HFT, events on both the trading client side and the exchange server side happen at an enormous rate. Things are changing and evolving tick-by-tick. Have you ever encountered the following situation? On your favorite exchange, the best ask price of BTC/USDC was $28,000.0, you placed a standard limit order to buy BTC at a price of $27,999.9, expecting the order would become resting on the order book and you would act as a market maker. To your surprise, after you sent the order, the exchange immediately sent you back a response indicating that the order had just been filled as a TAKER order! One possible scenario that could make such things happen was that when you placed the order, the order book on your trading server was stale and the best bid price from the exchange server’s perspective was actually $27,999.9. The staleness might be neither your trading server’s fault nor the exchange server’s fault, the message carrying the information that “the latest best bid price is $27,999.9” might be on the way traveling from the exchange to you! The end result is that you had to pay the hefty taker fee and the exchange shrugged its shoulder. A disaster for HFT, right? Well, in this particular case it was. The asynchronous nature of information flow in HFT is like a sword, but this sword can be double-sided! Is there some way that we might gain some “edge” from this sword instead of being hurt by it? It turns out there are.

One important part of HFT research is to spend plenty of time studying the details of an exchange’s API documentation and experimenting with the API. And to think beyond the documentation. The examples that we will present below are not limited to particular exchanges, but such out-of-the-box thinking or observation has to be carefully analyzed and verified on an exchange-by-exchange basis. Here we will use Kucoin as an example.

https://docs.kucoin.com/#match-execution-data is the public channel for Kucoin’s websocket feed which provides public trades information in realtime.

https://docs.kucoin.com/#private-order-change is the private channel for Kucoin’s websocket feed which provides private trades information in realtime.

The API requires us to establish two websocket connections: one for the public feed and the other for the private feed. Whenever one of your orders gets filled by your counter-party, the exchange has to broadcast two pieces of information at exactly the same time: one piece of information is to let the general public know that there was a trade that has just happened, the other piece of information is to let you (and your counter-party) know that one of your orders has just been filled. In an ideal world, these two pieces of information that were trigged by the same atomic event (your order getting filled) would become known to you at the same time. But obviously they wouldn’t. At the minimum, they have to come in through two different websocket connections, and therefore it is obvious that one of them would have arrived at your trading server earlier than the other. How much can the time difference be? We conducted our experiments using BTC/USDC on Kucoin and repeated it many times. It is an easy experiment to perform: subscribe to the above-mentioned data feed from Kucoin’s websocket API, place a buy order somewhere below the best bid price, wait it to be filled, and print out the messages of our private trades confirmation and the corresponding public trades broadcast.

14:32:20.066642693 Private - price: 28477.6, quantity: 0.0005172
14:32:20.227006291 Public - lastPrice: 28477.6, lastSize: 0.0005172

On UTC time 2023–05–01 14:32:20.066, our server received a private trade confirmation message. Some 161 milliseconds later, our server received the corresponding public trade broadcast. The profound implication of this time difference is that it enables us to know an underlying event happening on the exchange server before the general public has any clue about it. Remember that the general public includes your competitors who listens on the public data feed but doesn’t have private order updates around this particular moment. This is what we call “the private information edge”. A lot of interesting plans and actions can be made and taken accordingly. For one example, if the prevailing BTC/USDC best bid prices from many exchanges are around 29000.0, and all of a sudden we receive a private trade confirmation telling us that our buy order placed at 28477.6 is filled, and it is likely that no one else in the general public at this moment knows about it except you and perhaps your trade counter-party, should we immediately sell BTC/USDC on another exchange to make good use of those several hundred milliseconds time difference? For another example, if we place maker orders (we can call them Fishing Bobbers) at all interesting price levels with the minimal order quantities allowed by Kucoin, are we able to have a more complete peek over the order book state inside the exchange’s matching engine before any one else does? These tiny orders act like little spies carrying important information to you ahead of the general public. If you examine the public data feed for trades and level-3 order book data, are you able to identify these little spies from your competitor’s army? Use your imagination to figure out what else can be done with the help of the private information edge!

If you are interested in our work or collaborating with us, join us on Discord: https://discord.gg/b5EKcp9s8T and find us on Github: https://github.com/crypto-chassis/ccapi 🎉. We specialize in market data collection, high speed trading system, infrastructure optimization, and proprietary market making.

Disclaimer: This is an educational article rather than investment/financial advice.

--

--