D Zero University
D Zero University
D Zero University
Greg Graham
Senior Developer, Geneva Trading
[email protected]
Part 1
● (Source: Wikipedia)
Options: Puts versus Calls
● A Call is an option that gives the buyer the
option to buy a commodity at a specified price
● A Put is an option that gives the buyer the
option to sell a commodity at a specified price
● Synthetic Futures (see next slide)
– Long Call + Short Put =~ Long Future
– Short Call + Long Put =~ Short Future
● Arbitrage opportunity!
– Buy the synthetic and sell the actual, or vice versa.
– This is known as conversion/reversal.
Synth Arb: Payoff of an Options
Contract
● (Source: Wikipedia)
Arbitrage For Pedestrians
● In general, you traverse a cycle of financial instruments by
buying and selling and ending up “truly” flat.
– If your gross exceeds your fees, you win!
● Conceptually, it really is that simple.
● In practice, the field of arbitrage is very rich owing to the
sheer number of commodities and derivatives and the way
they can be combined.
● If you are not flat throughout the day (especially at the end
of the day), it is not true arbitrage.
– Being “truly” flat leads to small, risk free profits.
– In the conversion/reversal example, you are truly flat
only when you “leg out of/unwind” the position. Until
then you are carrying risk.
Arbitrage For Pedestrians
● Simple arbitrage
– Cross exchange, big versus mini contracts, Intercommodities, calendar
spreads
● Synthetics
– Conversions, reversals
● Statistical
– Pairs trading, correlation hunting
● Sniping vs. Market Making
– Sniping: Identifying price discrepancies and hitting all instruments at the
same time.
– Market Making: Quoting prices in one market based on prices in other
markets (“the lean”) such that if someone hits your quote, you can
immediately hit the leans and make a profit.
Another Fun Example: Futures
Calendar Spreading
● Exchanges define “spread” instruments that represent the cost
of buying a commodity in one month and selling it forward in
another month.
● A popular (and obvious!) arbitrage strategy is to pick N months
and look for pricing differences in the spreads.
– Eg- Buy “Sep-Dec”, Sell “Sep-Nov”, Sell “Nov-Dec”
– Lots of interesting graph theory involved in enumerating
possibilities.
– Lots of interesting engineering involved in identifying and
evaluating opportunities.
– Very competitive strategy. You MUST be very fast to make
money here.
Part II
Electronic Trading
Brief History
● Electronic trading has been evolving since the mid 1980's. It
has really taken off since the current millennium began.
● The CME (Chicago Mercantile Exchange) Globex system was
one of the earliest and is still today one of the most popular
platforms. (www.cmegroup.com)
Nuts and Bolts: Market Data and
Order Systems
● Connections to exchanges typically involve provisioning for
receiving market data and for order systems.
– Market data comprises moment to moment price data and
trade data, is high bandwidth, and is typically distributed
over UDP multicast
– An order system comprises a protocol running over TCP that
allows the firm to enter new orders, change existing orders,
cancel orders, and receive fill reports.
– Other systems include disaster recovery portals, continuous
“drop copy” of all orders executed, etc.
Abstraction: Market Book
● An abstraction that accumulates working orders in an “open”
market
Commodity X Quantity Price
Ask 52 99
Ask 63 98
Ask 32 97
Ask 15 96
Ask 5 95
Bid 8 92
Bid 22 91
Bid 42 90
Bid 101 89
Bid 87 88
● Updates streamed over UDP Multicast
● Difference between an open market and a “dark pool”: dark
pools have no market books. (Request for Quote instead.)
Order Protocols
● FIX (Financial Information eXchange) is a
common protocol
– Open source FIX engine: QuickFIX.
– ASCII “35=D 40=99 11=12345 ...” strings over TCP.
● A “standard”, but everybody has to agree on the meaning
of the tags.
● Exchanges compete with each other, so these all get
stuffed with special proprietary features anyway.
● Proprietary structured data protocols are also
becoming more popular.
– Better latency characteristics
Simple Diagram of a Trading Platform
Exchange Traders
TCP Session
Order Flow
Session 1 App 1
TCP Session
Order Flow
Order Flow Session 2 App 2
->New Order Requests
->Change Requests TCP Session
->Cancel Requests Order Flow
<-Acknowledgements
<-Reject Responses
Session 3 App 3
<-Order Fills
Match Engine
Trading apps make decisions about where to place orders
based on aggregated order information (eg- how many orders
are there at a given price, also known as a “market book”).
Inside the HFT Trading App
List of
Market Book Algo Prices, Order 2
Quantities
Engineering problem:
Efficiently present multiple streams of market data to an algo.
Maintain slate of orders algo wants with exchange.
The Importance of Latency
● If you are “sniping”, you want to be the first to decode the
market data and get your orders in.
– In software, a good multi-threaded architecture is critical.
● If you are “market making”, you want to be the first to decode
market data and get your quotes out of the way if a “lean”
disappears.
– Also if you get filled on a quote, you want to be the first to hit the lean.
● If you are trading speculatively, latency is not so important.
– Contrary to what you may hear ,HFT does not keep grandma and
grandpa from trading their retirement portfolios.
The Race to Zero
● Fast multi-core servers
– Must be able to decode multiple UDP multicast
streams at once
● Fast NICs
● Fast networks and routers
● Colocation services
– Exchanges often run a side business of hosting
servers with shorter cable runs to their match
engines.
● $$$
Part III
Technology
Platforms
● Linux/C++ is probably the most popular.
● Microsoft/.Net technologies are also well
represented.
– Thread scheduling tweaks: advantage Linux
– Time to develop: advantage Microsoft
● Servers: Top of the line, replaced frequently.
● It's hard to say what others may/may not be
using.
– Nobody talks about it!
Networking
● Gigabit ethernet on fiber is probably the most
standard.
– 10 Gig is becoming more popular.
– Typically, market data bandwidth still fits inside a
1 Gig pipe
● Typically, the low latency links are very
important at the colocation facilities and
between colocation facilities.
– Better than 1 mSec between server and exchange
– Not so important between the office and the colo.
● Costs: ~ $10k/month/rack
Software
● Independent Software Vendors
– Closed trading systems with varying degrees of
customization
– Trading Technologies, CQG, Reuters
– Colocated servers and gateways
● Proprietary Software
– Faster, more targeted, only includes important
features (to us!)
Next Gen Technologies
● Software: Fiber mode scheduling
– Scheduling tasks within a running thread
● FPGA technology
– Trade on a chip, takes the OS networking stack out of the
equation
– Coprocessors and ASICs
● CUDA
– Massively parallel operations on graphics cards
– Probably not suitable for the latency “hot path”
Next Gen Technologies
● Shorter fiber runs
– Spread networks (Under 15 mSec, $5k/month)
● Microwave links
– McKay bros. Beats fiber from Chicago to NY (Under 10
msec, $15k/month)
– Tradeworkx. (Beats McKay bros. $250k/month!!!)
–
– (Source: wired.com)
Monitoring
● Low latency is expensive, so we are serious
about monitoring.
● We use packet-packet correlation engines to
measure time differences of packets
entering/leaving our network
– Sensitive under 100 nSec
– Network taps on fiber – the measurement does not
add latency.
– Can very accurately measure both external
exchange latency and internal algo latency.
Part IV
Career
Career Path
● PhD, U of Chicago, 1999 (KteV)
● Postdoc, U of Maryland, 1999-2001 (DZero)
● FNAL Computing Division, 2001-2005 (CMS)
● Orbitz, LLC, 2005-2006
● American Chartered Bank, 2006-2009
● Mecury Holdings/Geneva Trading, 2009-Now
●