Technology Stack in HFT

Millions of market events happen in many of the stocks today. In a typical trading day, more than a billion market events happen in US equities. The HFT trading architecture as well as the data infrastructure are designed to work around this complexity.

Trading Architecture

Super fast communication, Low-latency TCP/UDP decoding in user space or FPGA, Lean & optimized book building & trading logic, Shared memory based queues for fast communication between processes.

Exchange

Stock Exchange - Fix Connnectivity for order routing and multicast stream for market data.

Network Switch

Servers and switches are co-located in the same data center as the exchange.

FPGA

Very useful for efficient programmable processing in harder. PCIe connectivity.

Trading Application

It is designed to make sure each market event is processed in less than 3-5 µs.

Order Routing Server

  1. Pools orders from multiple trading applications.
  2. Maintains exchange connectivity.
  3. Implements an additional layer of safety checks like order size check, position check etc.
  4. Uses shared memory to communicate with various trading applications efficiently in user space.

Co-location

Trading servers are located near the servers of different exchanges. Trading servers from different locations constantly communicate with each other to relay important updates on market and trading.


Job scheduling for data tasks

High frequency trading increasingly relies on efficient backtesting and superior modelling techniques. There is always an ongoing requirement for numerous studies. Robust data infrastructure is required to handle such data intensive tasks at such high scales. The following figure describes how we schedule the tasks.

Simulations

We use Celery, Rabbitmq and AWS spot instances to run our studies.

Priority

We have Daily / Manual / LongTerm queues to manage different priorities. Daily tasks have the highest priority because end-of-day and start-of-day tasks are more important.

Autoscaling

Spot instances are launched depending on the number of tasks in the queues, priority of the tasks and the price of the spot instances.