How to build low latency crypto trading systems using Java and Chronicle services

Click for: original source

Cryptocurrency trading is an emerging market with its own rules. However, when it comes to the need for low-latency arbitrage, that is, being able to react rapidly to changing market prices and placing orders ahead of the competition, there are lessons we can learn from optimizing classic trading systems. By Ivan Rakov.

In this article we’ll take a look at the techniques that the Binance exchange uses to provide market data to its customers, but the techniques and patterns used by this exchange are similar to many other exchanges as well. Exchange updates are provided by a websocket connection, typically over multiple channels with differing latency characteristics.

The article then pays attention to best practices and how to go about implementing efficient market data connector:

  • Allocation-free parsing
  • Determinism and reproducibility
  • Zero-cost events serialization
  • Low latency oriented and flexible threading model
  • Resulting architecture of crypto market data connectivity layer

A classic way of parsing a JSON is delegating it to a library, which returns a structured representation like JSONObject. This representation is usually an object tree that will be disposed of after the parsing is complete. Continuous creation of temporary objects causes extra pressure on the JVM garbage collector, which in turn may result in unpredictable latency spikes. Read full article to learn more!

[Read More]

Tags miscellaneous jvm java app-development programming