Cryptocurrency exchanges like Coinbase, Binance, and Kraken enable investors to buy, sell and trade cryptocurrencies, including Bitcoin, Litecoin, Ethereum and many more. Depending on the exchange, trades can be made using fiat currencies (legal government tender like U.S. dollars or Euros) or other cryptocurrencies. Most exchanges also allow investors to purchase one type of cryptocurrency with another (for example, buy Bitcoin with Ethereum.) Given the high velocity and high volatility of cryptocurrency valuations, monitoring and analyzing trading activity and the performance of trading algorithms is daunting. Kafka Streams provides a perfect infrastructure to support visibility into the market and participant behavior with a very high degree of temporal accuracy, which is critical when trading such volatile instruments.
In particular, cryptocurrency traders need several ways to visualize trading activity and rebuild and view their order books at full depth. They need tools that can make large numbers of complex real-time calculations, including:
– Best bids and offers
– Cumulative sizes for bids and offers
– Spread to the median
– Deltas between price events
– Time-weighted averages
– Message rates (new, cancel, trade, replace)
– Cumulative trade flow
All calculations must be done for multiple pairs of fiat currencies and cryptocurrencies in real time throughout the trading day. Traders must have visibility into all aspects of every order through to execution. New tools leverage the power of Kafka Streams that enable traders themselves to build directed graphs on screen, without writing any code. A directed graphs control data flows, calculations, and statistical analysis of cryptocurrency trading data and can output it the screen for in depth monitoring and analysis of real time data as well as historical trading data stored in in-memory time series databases. This paper describes practical approaches to building and deploying Kafka Streams to support cryptocurrency trading.