FPGAs in Trading

What is an FPGA?

A Field Programmable Gate Array, or FPGA, is a type of integrated circuit (IC) that contains an array of Configurable Logic Blocks (CLB) connected via a configurable interconnect. The CLBs can be configured to implement custom combinational and sequential digital circuits in a similar fashion as an ASIC, but with the advantage of easy reconfiguration. 

Modern FPGAs have different types of internal resources like memories and DSP cells that can be used to implement pretty much any data processing and control algorithms. 

FPGAs are normally programmed using a Hardware Description Language (HDL) like SystemVerilog or VHDL and can also be programmed with High level synthesis (HLS) using transcompilation  from high-level languages (SystemC, Python, MATLAB and C/C++) to HDL.

The HDL is synthesised in a process that converts the code into a netlist of basic CLB and memory elements. This netlist is then placed and routed to generate the executable binary. 

The image below shows placed and routed CLBs (blue) in a Xilinx FPGA.  

Due to its versatility, FPGAs are used in all sorts of industries like aerospace & defence, ASIC prototyping, automotive, broadcast & pro AV, consumer electronics, data centre, high performance computing and data storage, medical, security, video & image processing, telecommunication, etc.

Role of FPGA in trading

Like in many other industries that rely on large amounts of data, trading employs FPGA predominantly as accelerators. Between several different application we can highlight a few examples where FPGA acceleration is widespread: data processing acceleration and networking acceleration.

Data processing acceleration

FPGAs can be used as co-processors to accelerate data analysis and processing in research and production environments. 

If we consider the example of Options Pricing using Monte Carlo simulation. In the figure below, f2 represents the Monte Carlo simulation run in a multi-core processor. The number of parallel runs is limited by the number of available cores in the system. 

If we move f2 to a FPGA co-processor, the number of parallel runs is only limited by the size of the FPGA. Most current  FPGA platforms can host hundreds of calculation engines. 

This type of co-processing can yield large run time savings if used properly. The caveat here is the data transfer overhead, specifically the PCIe latency. The amount of processed data needs to justify the PCIe delays for this approach to be efficient. 

Networking acceleration

Another common area of acceleration in trading is networking. 

For example, COTS ethernet switches are designed to deal with all possible options and  scenarios covered by the Ethernet standards. Normally, this completeness often comes at the cost of processing latency. FPGA based switches allow users to implement their own internal logic, prioritising their required features and removing unused ones. 

Another commonly customised FPGA based networking device are Network Interface Cards (NIC). A lot of processing and reaction latency can be saved by moving trading algorithms inside the NIC and closer to the exchange. 

In a typical software only execution system, market data is received by the NIC and forwarded to software via PCIe. In software the market data is decoded and used by the trigger algorithm to decide if an order (buy or sell for example) needs to be sent to the exchange or not. In case an order is generated, the order is built and transferred via PCIe to the NIC to be sent to the exchange.

If the market data decoding, trigger and order building functions are moved inside the NIC the system’s reaction time can be greatly reduced. Even if we disregard the gains generated by implementing the processing functions in FPGA, the removal of PCIe transfer delays already reduces the system’s latency considerably. 

Conclusion

In this article we covered just a few examples of how FPGAs are used in trading. Over last 10 years FPGAs became essential tools for trading, allowing not only low latency execution close to the exchange but also accelerating data analysis in research and production environments. 

FPGAs are at the centre of Maven’s trading systems, and as such our FPGA engineers work closely with trading and software teams to implement and optimise high performance systems. We employ the most advanced FPGAs in the market, pushing the limits of existing hardware and tools in order to achieve the best possible performance. 

NY INTERN BLOG
Catching up with our NY intern
Settling into Maven life My name is Alejandra Freyre and I worked...
MAVEN ON C++23
Maven on C++23
Introduction At Maven we are always excited to adopt a new version...
JO'S JOURNEY BANER
A Mavenites Journey
I joined Maven 4 years ago as a Business Development Analyst....
POST-1
Maven’s June Chronicle
Markets are wrestling with the question as to which is the greater...
POST-3
Machine Learning in Algorithmic Trading
Algorithmic trading systems are sets of rules that automate the...
POST 7 V2
March Chronicle
Most of our discussions with counterparts over the last few weeks...