23
DSL Programmable Engine for High Frequency Trading Acceleration By Heiner Litz, Christian Leber & Benjamin Geib University of Heidelberg Presenter :– Pasan De Silva UCSC 05 – 12 2013 1 DSL Programmable Engine for High Frequency Trading Acceleration

Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Embed Size (px)

DESCRIPTION

Paper presented, - [ H. Litz, C. Leber, and B. Geib,"DSL programmable engine for high frequency trading acceleration," In Proceedings of the fourth workshop on High performance computational finance (WHPCF '11). ACM, New York, USA, November, 13, 2011, pp. 31-38. ] addresses the domain of High frequency trading Acceleration using FPGA solutions from the perspective of a HFT firm

Citation preview

Page 1: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

DSL Programmable Engine for High Frequency Trading Acceleration

1

DSL Programmable Engine for High Frequency Trading

Acceleration

ByHeiner Litz, Christian Leber

& Benjamin Geib

University of Heidelberg

Presenter :– Pasan De Silva

UCSC05 – 12 2013

Page 2: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Authors

Heiner LitzPostdoctoral Research Fellow at Stanford University

2

Benjamin GeibPerformance Engineer at IMC financial

markets & asset management

Christian Leber.University of Heidelberg

DSL Programmable Engine for High Frequency Trading Acceleration

Page 3: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Basic trading infrastructure

3

Exchange

Market Participants

Feed Handler

DSL Programmable Engine for High Frequency Trading Acceleration

Page 4: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

What is HFT

Describes a set of techniques

within electronic trading of stocks where

a large number of orders are injected into the market

at sub-millisecond round-trip execution times

4

DSL Programmable Engine for High Frequency Trading Acceleration

Page 5: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

HFT

Do not hold significant positions. (On average HFT holds a stock for about 22 seconds)

Generates revenue by buying and selling at a high speed.

Huge Impact !!! Around 73% of the trading volume on the U.S.

equity market is due to HFT. But only 2% of 20 000 firms trade using HFT.

5

DSL Programmable Engine for High Frequency Trading Acceleration

Page 6: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Strategies of HFT

Cross-market arbitrage Liquidity providing (narrowing the bid

ask spread) makes money out of urgency of sellers

High volatility

All strategies require absolute lowest round trip latencies. Only the fastest HFT

will benefit.

6

DSL Programmable Engine for High Frequency Trading Acceleration

Page 7: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

How to achieve speed

The most time consuming tasks are offloaded in to optimized hardware blocks.

No need to travel through additional stacks. Every thing is handled at hardware level.

7

DSL Programmable Engine for High Frequency Trading Acceleration

Page 8: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

What is FPGAs

Field-Programmable Gate Array, a type of logic chip that can be programmed.

A semiconductor device that can be programmed after manufacturing. Instead of being restricted to any predetermined hardware function, an FPGA allows you to program product features and functions and reconfigure hardware for specific applications even after the product has been installed in the field

FPGAs can be reprogrammed to desired application or functionality requirements after manufacturing.

8

DSL Programmable Engine for High Frequency Trading Acceleration

Page 9: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

FAST protocol

Outstanding orders are made visible to market participants

A feed carrying this information is multicasted to the market participants using standardized protocols and transmitted over UDP over Ethernet

Compression mechanisms to reduce bandwidth introduces significant CPU overhead.

Decoding FAST is a major bottleneck in HFT.

9

DSL Programmable Engine for High Frequency Trading Acceleration

Page 10: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Proposed approach

Offloading decoding IP, UDP and Eth to optimized hardware blocks

Directly Decode FAST messages in the hardware.

Introduce parallel hardware structures to enable simultaneous decoding of multiple streams.

10

DSL Programmable Engine for High Frequency Trading Acceleration

Page 11: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Trading Decision making decision to buy or sell a stock, can be a very

complex and resource consuming task.

a variety of given parameters and incoming variables are compared using mathematical and statistical approaches

Due to its complexity, the decision making process is not offloaded to the FPGA but kept in software.

11

DSL Programmable Engine for High Frequency Trading Acceleration

Page 12: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Trading accelerator architecture

12

DSL Programmable Engine for High Frequency Trading Acceleration

Page 13: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

IP, UDP and ETH decoding in Hardware

To reduce the latency of market data processing decoding of the complete IP, UDP and Ethernet stack is off loaded into hardware.

The Ethernet MAC as well as decoding of the different protocol layers is handled by a number of internal modules.

13

DSL Programmable Engine for High Frequency Trading Acceleration

Page 14: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

FAST decoding in Hardware

FAST decoding has also been offloaded into hardware.

Each feed handler can define own templates. A microcode engine is used that supports a set of

instructions which enables it to decode any variation of the FAST protocol.

microcode is derived from a specification written in a domain specific language (DSL)

DSL is specifically developed for this project. The DSL description is then passed to a compiler

which transforms it into binary microcode that can be executed by the microcode engine.

14

DSL Programmable Engine for High Frequency Trading Acceleration

Page 15: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Fast decoder

15

DSL Programmable Engine for High Frequency Trading Acceleration

Page 16: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Optimization baseline implementation provides an

aggregated latency of only 2.6 us to decode the Ethernet, UDP and FAST data stream and transfer it to user space where it can be accessed by software.

But the analysis shows,

D fast realistic > D max

Needs to optimize further.

16

DSL Programmable Engine for High Frequency Trading Acceleration

Page 17: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Optimization technique 01Custom Instruction Segments.

offer discrete microcode segments, not only for each template but also for each

{TID, PMAP} tuple. Can increase development O/H substantially. Interestingly, only 5 tuples represent a 92%

probability of occurrence. Discrete microcode segments for these tuples

and generic microcode segments for the rest.

17

DSL Programmable Engine for High Frequency Trading Acceleration

Page 18: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Only five tuples represent a 92% probability of occurrence

18

DSL Programmable Engine for High Frequency Trading Acceleration

Page 19: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Other optimization techniques

Branch pre calculation

Variable Length Field Processing

19

DSL Programmable Engine for High Frequency Trading Acceleration

Page 20: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Evaluation improvements. In total, the baseline approach offers a Dmax of

4.8Gbit/s could be improved by over 56% to a new Dmax, optimized of 7.5Gbit/s.

20

Page 21: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Multi-threaded Performance Results

21

DSL Programmable Engine for High Frequency Trading Acceleration

Page 22: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Positives Very useful high end research. Clear language usage Appropriate usage of graphs and images.

Too summarized. Highly complex. Poor related work section. Considerable level of duplications with their original

paper.

22

Negatives

DSL Programmable Engine for High Frequency Trading Acceleration

Page 23: Dsl programmable engine for high frequency trading by Heiner Litz et al. (Presented by Pasan De Silva)

Thank you !!!

23

DSL Programmable Engine for High Frequency Trading Acceleration