This repository provides a comprehensive lab environment for analyzing high-frequency trading performance through a minimal, fully instrumented datapath on a Pynq-Z2. By juxtaposing a tiny quantized MLP on FPGA against CPU-driven reflex rules, it enables precise cycle counting and valuable insights into latency dynamics.
The hft-latency-lab repository presents a minimal, fully instrumented high-frequency trading (HFT) datapath utilizing the Pynq-Z2 FPGA. This project conducts a performance comparison between a tiny quantized Multi-Layer Perceptron (MLP) running on FPGA and hard-coded reflex rules executed on an ARM CPU, focusing notably on cycle-accurate latency breakdowns.
This initiative aims to establish a measurable HFT datapath that interacts with real hardware rather than relying solely on Python backtesting. The setup includes:
In this setup, the Ethernet connection is bypassed, and all components are integrated within the Pynq:
A detailed analysis of where time is spent in terms of various computational operations (such as math, AXI, DMA, and other control logic) is conducted using different design overlays.
Performance is evaluated at 125 MHz on the Pynq-Z2, with cycle measurements as follows:
Cycles are further analyzed through cumulative distribution functions (CDFs) captured during the benchmarking, detailing the p50 and p99 latency metrics for both ARM and FPGA processing paths.
This repository serves not only as a benchmarking tool but also as a comprehensive study on the latencies involved in HFT systems running on Pynq-Z2. Insights gathered indicate that while a 64-cycle MLP can effectively process data, it becomes constrained by a larger 100k+ cycle shell, which emphasizes the importance of well-designed architectures in achieving optimal performance.
For those interested in experimenting or analyzing the findings, detailed scripts and guidelines are provided within the repository.
No comments yet.
Sign in to be the first to comment.