D Zero University

Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

HFT: Futures and Arbitrage

Greg Graham
Senior Developer, Geneva Trading
[email protected]
Part 1

Futures and Arbitrage Basics


Styles and Flavors of Trading
● Categories as varied as branches of physics or
mathematics
– Instruments: Equities, Commodities, Bonds, FX
● Derivatives on these: Futures, Options, Swaps
– Markets: Energy, Ags, Metals, Currency, Interest
Rates
– Tactics: Going long, going short, being flat
– Strategy: Speculative, Risk Averse, “Risk Free”
● Arbitrage, Statistical Arbitrage, Algo trading
– Methods: Open Outcry, Electronic, Day trading,
"point and click”, HFT
Futures and Options
● A futures contract obligates the exchange of a
specified quantity of a commodity at a specified
date and price.
– Physically versus financially settled
● An options contract gives the buyer the option
to buy/sell a specified quantity of a commodity
at a specified date and price.
– Both types of derivatives are useful for “hedgers” to minimize
risk.
– Speculators provide liquidity and a smaller bid-ask spread.
– Risk may be unlimited, depends on your objectives.
Aside on MF Global
● Because of the unlimited risk, margin is
required for all futures (and options) traders.
– Margin is cash held by a broker or a clearing house
to cover deteriorating positions.
9

MF Global “blew up” and took > $10 customer
money with them.
– That was customers' margin money!!!
– Futures volumes are still down 40% as a result
● Coincidentally, MF Global went bankrupt when
they couldn't meet a margin call.
Aside on MF Global
● Because of the unlimited risk, margin is
required for all futures (and options) traders.
– Margin is cash held by a broker or a clearing house
to cover deteriorating positions.
9

MF Global “blew up” and took > $10 customer
money with them.
– That was customers' margin money!!!
– Futures volumes are still down 40% as a result
● Coincidentally, MF Global went bankrupt when
they couldn't meet a margin call.
Synth Arb: Payoff of a futures
contract

● (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

UDP Multicast Market Data


->Aggregated information about
all orders
->Notifications about
consummated trades
-> Market state information

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

Market Book Order 1

List of
Market Book Algo Prices, Order 2
Quantities

Market Book Order 3

Market Data Flowing In Order Flow


(possibly multiple sources) (Maintain order state with exchange)

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

● Experience is important – but you can be


incremental.
Resume/Interview Tips
● Always strive to learn new things at every job.
– Never be complacent on this point!
● Make sure your resume is up to date
– Make sure you are up to date w.r.t the resume ;-)
● Practice interviewing
– Apply for some jobs just to practice the interview!
– Learn something from every interview
So You Want a Finance Job...
● Know what kind of position you are interviewing
for, and tailor your pitch.
– IT developer: Expect to be tested on multi-threaded design
and coding gotchas. Expect the f2f to focus on some OO
design problem.
– Analyst/Quant: Expect to be tested on basic finance, pricing
theory. Expect the f2f to include some goofy brain teasers.
● Some companies give the brain teasers to developers too
– There are also niche positions: FPGA (VHDL/Verilog) is
becoming more popular.
● Non disclosure/Non competes are standard.
– Be ready to have an attorney look it over.
– These are often negotiable.
Geneva Trading
● Offices in Chicago, New York, Dublin
– Http://www.geneva-trading.com
● We have diverse trading styles
– HFT trading on proprietary platform
– ISV “point and click” trading
– Algo trading
– Primarily futures, some options
● Starting to dip toes in equities
● We have no customers
● Looking for junior devs now, probably senior
dev after Jan 1.
Conclusion
● HFT is a very challenging, fast paced, and rich
environment.
● Latency is the overriding concern. It definitely
costs $$$ to play the game.
● We're always looking for new technologies (or
new applications of old technologies) to achieve
latency goals.
● Always be learning new things, and you will
never get bored.

You might also like