Book Image

Developing High-Frequency Trading Systems

By : Sebastien Donadio, Sourav Ghosh, Romain Rossier
5 (1)
Book Image

Developing High-Frequency Trading Systems

5 (1)
By: Sebastien Donadio, Sourav Ghosh, Romain Rossier

Overview of this book

The world of trading markets is complex, but it can be made easier with technology. Sure, you know how to code, but where do you start? What programming language do you use? How do you solve the problem of latency? This book answers all these questions. It will help you navigate the world of algorithmic trading and show you how to build a high-frequency trading (HFT) system from complex technological components, supported by accurate data. Starting off with an introduction to HFT, exchanges, and the critical components of a trading system, this book quickly moves on to the nitty-gritty of optimizing hardware and your operating system for low-latency trading, such as bypassing the kernel, memory allocation, and the danger of context switching. Monitoring your system’s performance is vital, so you’ll also focus on logging and statistics. As you move beyond the traditional HFT programming languages, such as C++ and Java, you’ll learn how to use Python to achieve high levels of performance. And what book on trading is complete without diving into cryptocurrency? This guide delivers on that front as well, teaching how to perform high-frequency crypto trading with confidence. By the end of this trading book, you’ll be ready to take on the markets with HFT systems.
Table of Contents (16 chapters)
1
Part 1: Trading Strategies, Trading Systems, and Exchanges
5
Part 2: How to Architect a High-Frequency Trading System
10
Part 3: Implementation of a High-Frequency Trading System

Use case - Building an FX high-frequency trading system

A company needs an HFT system capable of sending an order within 20 microseconds. To do this, the company can follow this approach:

  • Choose a multi-process architecture over a multi-core architecture.
  • Ensure each process is pinned to a specific core to reduce context switches.
  • Have processes communicating over a circular buffer (lock-free data structure) in shared memory.
  • Design the network stack using Solarflare OpenOnload for network acceleration.
  • Increase the page size to reduce the number of TLB cache misses.
  • Disable hyperthreading to get more control over the concurrency execution of the processes.
  • Use the CRTP to reduce the number of virtual functions.
  • Remove runtime decisions by using templated data structures.
  • Pre-allocate data structures to avoid any allocation on the critical path.
  • Send fake orders to keep caches hot and allow an order to go out at the last moment.

In...