You are on page 1of 59

Financial Engineering 2_Lecture 5_24.1.

2018_Kaila
Aalto_University
today
High-frequency trading HFT
algorithmic trading
limit order book
What is algorithmic trading?

Ruth Kaila 3
Algorithmic trading Decimalization: A system where
security prices are quoted using
a decimal format rather than
fractions (3.25 vs 3 ¼). Before
2001, markets in the United
States utilized fractions in
price quotes.

the use of programs and computers to generate and execute


(large) orders in markets with electronic access

• Rather than maximize profit, the main objective of algo


trading is to control execution costs and market risk.
• Algorithms started as tools for institutional investors in the
beginning of the 1990s.
• explosion of algorithmic trading in the beginning of the
2000 due to decimalization, direct market access (DMA;
electronic trading facilities), 100% electronic exchanges,
reduction of commissions and exchange fees, the creation
of new markets aside from NYSE and NASDAQ and Reg NMS
(Regulation National Market System).
• Artifial Intelligence is coming
Average amount of time a stock held in U.S.
- 1945 - 4 years
- 2000 - 8 months
- 2008 - 2 months
- 2011 - 22 seconds

high The greatest portion of present day algo-


trading is high-frequency trading

Traditional
Long-term investing
Execution
latency

Algorithmic or electronic trading

HFT
high frequence trading
low

short Position holding period long


Source: Aldridge
Strategies of algorithmic trading earlier made by brokers
who break the orders
in smaller parcels

Name of Algo strategy Description of strategy


Trade execution algorithms Designed to minimize the price impact of
executing trades of large volumes by
splitting orders into smaller parcels and
slowly releasing these into the market.

Strategy implementation algorithms Designed to read real-time market data


and formulate trading signals to be
executed by trade execution algorithms.
Stealth/gaming Designed to take advantage of the price
algorithms movement caused when large trades are
filled, and also to detect and outperform
other algorithmic strategies.

Source: ASIC 2010


Institutional clients need to trade large amounts of stocks.
These amounts are often larger than what the market can
absorb without impacting the price.
The demand for a large amount of liquidity will typically affect
the cost of the trade in a negative fashion (``slippage’’)
Large orders need to be split into smaller orders which will be
executed electronically over the course of minutes, hours, day.
Three steps of algo large order trading
Trade scheduling: splits parent order into ∼ 5 min
slices
relevant time-scale: minutes-hours
tradeoff time with execution costs

Optimal execution of a slice: divides slice into child


orders; relevant time-scale: seconds-minutes

strategy optimizes pricing and placing of orders in


the limit order book LOB; tradeoff of price versus
delay; execution adjusts to speed of LOB
dynamics, price momentum

Order routing: decides where to send (which


limit-order book, which exchange) each child
order; relevant time-scale: 1- 50 ms

optimizes fee/rebate tradeoff,


liquidity/price, latency, etc.
Technical Requirements for Algorithmic Trading

• Network connectivity and access to trading platforms for placing the


orders
• Access to market data feeds that will be monitored by the algorithm for
opportunities to place orders

Implementing the algorithm using a computer program is the last part,


clubbed with backtesting. The following are needed:
• Computer programming knowledge to program the required trading
strategy or pre-made trading software
• The ability and infrastructure to backtest the system once built, before it
goes live on real markets
• Available historical and real time data for backtesting, depending upon the
complexity of rules implemented in algorithm
Benefits of algorithmic trading

• Trades are executed at the best possible prices


• Trades timed correctly and instantly, to avoid significant
price changes
• Reduced transaction costs
• Simultaneous automated checks on multiple market
conditions
• Risk of manual errors in placing the trades is reduced
• Backtest the algorithm, based on available historical and
real time data
• Reduced possibility of mistakes by human traders based
on emotional and psychological factors
Algos help to cope with fragmentation
Fragmented markets
• need to search for trading opportunities, compare
prices, etc...
• Algos reduce search costs & increase search speed
• More trading opportunities can be identified
(Latency arbitrage for High-frequency trading)

Picture: valuewalk
Market fragmentation, example

Picture: valuewalk
Market making and the limit order book

Ruth Kaila 14
If there is a book order that matches the
incoming order then a trade is executed. The
new order is termed aggressive (or LIMIT ORDER BOOK LOB
marketable) because it initiated the trade,
while the existing order from the book is
deemed passive.

Bid – purchase
Offer/ask - sale
From lecture 1

What are market makers?

'Market Makers’ by Investopedia:

• A market maker is a broker-dealer firm that assumes the risk of holding a certain
number of shares of a particular security in order to facilitate the trading of that
security. Each market maker competes for customer order flow by displaying buy and
sell quotations for a guaranteed number of shares, and once an order is received
from a buyer, the market maker immediately sells from its own inventory or seeks an
offsetting order.
• The Nasdaq is the prime example of an operation of market makers, given that there
are more than 500 member firms that act as Nasdaq market makers, keeping the
financial markets running efficiently.

Market making

• Market making describes placement of limit orders on both sides of


the market price.
• A market maker placing a limit buy order just below the market price
and a limit sell order just above the market price creates or ‘makes’ the
market.
• If a market buy order arrives from another market participant, it is
matched with the market maker’s limit sell order, and the limit sell order
is executed (i.e., a short position is recorded in the market maker’s
account.)
• If a market sell order arrives from yet another market participant, it is
matched with the market maker’s limit buy order, and a long position is
added to the market maker’s account.
• If the size of the long position is added to the market maker’s portfolio,
the market maker collects the spread as a compensation form
providing limit orders, or liquidity, to traders placing market orders.
Based on Aldridge, 2013
Market making
risks

When placing limit orders, the market maker is subject to two risks:
Inventory risk
• The potential loss the market maker might incur when the value of his
inventory declines in price due to natural market movements. Thus, the market
maker accumulating a long position (buying) in a downward-trending market is
likely to experience a loss on his position, at least for a short term.
• When the market maker whishes to close his position, he may face competition
from other parties looking to sell their positions at the same time.
Risk of adverse selection
• Potential loss due to informational differences between the market maker and
a market taker.
Simple market
making strategies

Fixed offset
• Continuous placing of limit orders at a predetermined number of ticks away from
the market price, on both sides of the market.
• Limit orders placed at current market quotes are likely to be executed.
• In most financial instruments, market makers are allowed to place limit orders only
within 10 percent of the current market price, to prevent quotes far away from the
market from executing at times of extreme volatility.
• The smaller the offset of a limit order from the market price is a simple strategy, the
higher the probability of order execution, and the more frequent the resulting
reallocation of the market maker’s capital. Frequency of trading has been shown to
be the key to market maker’s profitability.
Volatility-dependent offset
• one way to vary the offset is to make it a function of volatility.
• In high-vola conditions, limit orders farther away from the market are likely to be hit.
Offset is a function of order-arrival rate
Amount of information available about
the Limit-Order-Book LOB

depends on the needs and resources of the traders.


• the only information that is publicly available (in real time) is the last
traded price or the mid-price (the point between the current best prices).
Level 1 market data
• information on the price and size for the best prices, along with the price
and size of the last recorded transaction; needs subscription
Level 2 market data
• the complete contents of the book (except for certain types of hidden
orders)
• For individual subscribers, the current cost of receiving real time level 2
data for equities from just the New York Stock Exchange (NYSE) exchange
is $5000/month.
Trading in LOB
Trading in a LOB is a highly complex optimization problem.
• Traders may submit buy and/or sell orders at different times, prices,
quantities and – in today’s highly fragmented markets – often to multiple
order books.
• Order may also be modified or cancelled at any time.
• In addition to limit orders also fixed orders

• Market makers are typically assumed to provide liquidity, and therefore they
are often afforded special trading privileges related to order flow and trade
execution. Such privileges include
– access to order flow and order flow information,
– direct connections to exchange trading mechanisms,
– low transaction costs, and high transaction speeds.

• In return, they are often assumed to perform the social and market function
of supplying liquidity, for example by absorbing temporary order imbalances.
Several measures
for liquidity
• The tightness of the bid-ask spread
– Reflects the degree of competition among limit order-placing traders
• Market depth at best bid and best ask
– ability to sustain relatively large orders without impacting the price of the
security
• Shape of the order book
– When available, level II data can be used to calculate the exact amount of
aggregate supply and demand available on a given trading venue.
• Price sensitivity of order-flow imbalance
– How the price moves following an order; low liquidity makes the market eat
through the limit order book, moving the price substantially
• Market resilience
– How fast an order book recovers its shape following a market order
• Et cetera
What is high-frequency trading HFT?

Ruth Kaila 23
What is high-frequency trading HFT?

What are commonly used trading strategies?

What is its economic impact?

Is there a need for regulatory interventions?


High-frequency quotes

1 millisecond
High Frequency Trading Today

High frequency trading is a specialized case of algorithmic trading


involving the frequent turnover of many small positions of a security.
There is no formal definition of HFT. The U.S. Securities and Exchanges
Commission attributes certain specific characteristics:
• The use of extremely sophisticated and high-speed computer
programs for generating, routing, and executing orders.
• The use of individual data feeds from exchanges as well as co-
located servers in order to minimize network and other types of
latencies.
• Maintaining very short timeframes for establishing and liquidating
positions, resulting in the frequent turnover of many small positions
in one or more financial instruments.
• Submitting a number of orders that are cancelled soon after
submission.
• Maintaining very few, if any, overnight positions.
2016

Pictures: Business Insider Nordic


Along with the rise of HFT, the bid-ask spreads for large
cap stocks have tightened and the bid-ask spread of
small caps have widened: HFT is concentrating on the
trading in the most liquid, biggest stocks.

Pictures: Business Insider Nordic


Lit and Dark pools
A Pool - any place where trading takes place.
A Lit Pool – pool where the trading is visible to the public. (for example, NYSE and Nasdaq),
displayed markets
Dark Pools are alternatives to the exchanges where price and size of orders are revealed only to
participants (“upstairs trading” in the past).
• secret block-trading venues for institutional traders
• large sells or buys of an asset don’t affect the asset market price (what happens to the
price in traditional displayed markets? )
• lower trading fees than in the traditional displayed markets
• 40-50 dark pools in U.S, accounting for 33% of trading volume in 2012, Europe much less
• first used by big institutional investors to avoid HF traders taking profit from
their bids and offers; now days also for HF traders, as dark pools want to grow
• owned by banks, brokers et cetera.
• risky: can you trust your dark pool?

• MIFID II Markets in Financial Instruments Directive restricts dark pools (Husman next Friday will tell
more)
picture by WSO
HFT firms generally use private money, private technology and a
number of private strategies to generate profits.

Different types of HFT companies


Independent proprietary firm 48 %
• use private money and different strategies
• most of them tend to remain rather secretive about their
operations.
• many firms act as market makers, generating buy and sell orders
automatically throughout the day

Many of the regular broker-dealer firms have a sub section known as


proprietary trading desks for HFT is done. 46 %
• separated from the business the firm does for its regular, external
customers.
• examples include some of the largest investment banks.

Hedge funds 6 %
• generally focus on statistical arbitrage and take advantage of
pricing inefficiencies among various asset classes and securities.
Ideal asset
attributes
to HTF
Similar to other traders
Heavy trading volume -> narrower bid-ask spreads and abundant liquidity
But
Low volatility
• A trading environment where small amounts of profit can be made
with near 100% certainty is preferably to one where larger amounts
of profit can be made with a lesser degree of certainty. (typically
traders prefer high vola)
Low stock price – the volume of trading is important
• As rebates are based on the number of shares traded, so for the same
amount of funds deployed in a trade, an HFT firm can earn a larger
total rebate on a lower-priced stock than on a higher-priced stock.
(typically traders are indifferent to the price)
Name of HFT strategy Description

Electronic market making Liquidity-providing strategies that mimic


the traditional role market makers once
played. These strategies involve making a
two- sided market aiming at profiting by
earning the bid-ask spread. This has
evolved into what is known as Passive
Rebate Arbitrage.

Statistical arbitrage Traders look to correlated prices between


securities in some way and trade off of
the imbalances in those correlations.
Liquidity detection Traders look to decipher whether there
are large orders existing in a matching
engine by sending out small orders
(“pinging”) to look for where large orders
might be resting. When a small order is
filled quickly, there is likely to be a large
order behind it.

Source: Aldridge 2010


Main strategies of HFT

Ruth Kaila 35
Liquidity providing
Rebate trading
Market making
Trading the tape
Filter trading
Momentum trading
Statistical trading
Statistical arbitrage
Technical trading

Main strategies of HTF (P Rowley, T3live)


Certain exchanges and electronic
communication networks (ECN) offer
traders a rebate for providing the
markets with shares, or liquidity, when
there is a need for it.
The traders are
• paid to buy at the bid price and sell
at the ask price, thereby providing
liquidity, and
• charged for placing market orders
(orders with fixed price; these orders
don’t always contribute to liquidity
providing) (vs limit orders).

Liquidity rebate traders look for large


orders, and fill a part of it. Then, they
offer these shares back to the market by
placing a limit order, which makes them
eligible to collect the rebate fee for
providing liquidity, with or without them
making a capital gain.
Liquidity providing
Market making

Regulatory exemption to reduce spreads by creating a more


liquid market
• Profit earned from the spread between the bid and offer
as well as ECN rebates for providing liquidity
Examples
• Designated market makers (DMMS) with obligation to
maintain an orderly market by providing a required
amount of liquidity in specific stocks
• Supplemental liquidity providers obligated to maintain the
national best bid or offer 5 % of the trading day.
Trading the tape

information over telegraph lines, in use between around


Filter trading

communications medium, transmitting stock price


Ticker tape was the earliest digital electronic
Monitor the stock that show significant changes in
movement and/or volume
• Constant monitoring of thousands of stocks for
mechanical signs of announcements, rumors, news items

1870 through 1970


• Identifies stocks that meet a threshold level of variance in
the rate of change of price action and/or volume and
buys/sells accordingly

Examples:
• News story causes spike in price and large jump in
volume, algorithm rapidly buys.
• Algorithm recognizes a major uptick in the pace of the
bid being hit and shorts stock until pace declines.
Momentum Ignition Strategies

Initiating and cancelling a number of trades and


orders with a certain security in a particular
direction, which may ignite a rapid market price
movement.

The quick submission and cancellation of these


orders could get detected by algorithms of other
traders, resulting in them buying or selling the
security. The firm submitting these orders and
trades—by virtue of having established a position
early on—can then profit by leveraging the
subsequent price movement.
Trading the tape
Momentum trading
Identify temporary supply-demand
imbalances and trade with short-
term momentum as equilibrium is
restored.
• Typically very rapid entry and exit
of stock attempting to extract
small capital gains.
Example
• Detect large buying interest
creating imbalance, buy shares
and hold until price is reached
where selling pressure creates
equilibrium and price action stalls.
Statistical Trading
Statistical Arbitrage

Exploit pricing differentials between correlated


securities and markets
• Uses multiple exchanges and various asset
classes.
• Defines maximum range of variance and takes
counter trade when that range is exceeded.
Example
• Derivative prices and the underlying asset
(call option and the stock)
• Exchange-traded funds against the holdings
• Highly correlated stocks (Pepsi and Coca-Cola)
• Companies and their input resources (Gold
miners and gold commodity)
Statistical trading
Technical trading

Discover technical setups based on pre-


defined recurring patterns in stock prices
• Selects stocks that fit particular
technical patterns that have been shown
to create favorable risk-to-reward
opportunities.
• Entries and exits are precisely defined
price points based on rules of technical
analysis.
Examples
• Track stocks crossing 5-day moving
average and buy or sell on cross and
close position after pre-defined profit
objective is met
News and event arbitrage
two strategies: smoking and spoofing

Ruth Kaila 45
high frequency
traders first post
locking limit
orders to attract
slow traders. Then
they rapidly revise
these orders onto
less generous
terms, hoping to
execute profitably
against the
incoming flow of
slow traders'
market orders.
“spoofing.” Suppose the high frequency trader’s true
intention is to buy. Paradoxically, he or she will
initially place limit orders to sell in the order book.
These orders are not intended to be executed.
Therefore they are placed above the best ask. And,
since the high frequency trader is faster than the
other market participants, he or she can rest assured
he or she will have time to cancel the sell orders
before they are executed if good news reach the
market.

With this assurance in mind, the high


frequency trader places a sequence of limit sell
orders above the best ask, potentially for very
large amounts. The hope is to scare the market
and induce some naïve participant to sell ...
against the limit order to buy the high
frequency trader will have discretely placed
meanwhile.
How has high frequency trading affected the
markets?

Ruth Kaila 48
Positive Impact of HFT on Markets

Positive Impact on Markets

Increased Liquidity
HFT firms contribute to over 50% of the equity turnover by volume in some major
markets, and play a critical role in providing order flow, increasing the liquidity
level.
Traditional liquidity providers such as market makers now earn rebate fees by
leveraging HFT strategies to make up for the loss of income caused by smaller
spreads.

Narrowing Spreads: The use of algorithms and computers in trading has resulted in
the prices of securities being updated more frequently and more accurately.
This indicates that HFT has resulted in traders providing the most competitive bid-
ask prices and in spreads narrowing.

Improved Market Efficiency


In more efficient markets, prices reflect market information more quickly and
accurately. HFT enables this to happen by ensuring accurate pricing at smaller time
intervals.
Negative Impact of HFT on Markets
Impact on Institutional Investors:
certain HFT strategies look for repetitive trading patterns and front run the institution by
detecting an incoming order flow, after which the HFT system buys the same security and
then turns around and sells it to the institution at a slightly higher price. Such strategies
from HFT participants may adversely impact the strategy and market impact costs for these
institutional investors.

Increased Volatility: intraday trading with positions generally held only for minutes—or
even just seconds can give rise to price fluctuations and short term volatility.
• High impact on market volatility as HFT trading volumes are high
• The practice of making trades and instantly cancelling them only to trigger automated
buying from other firms is an ethical issue

Disadvantages to the Smaller Investors: HFT firms leverage special services such as co-
location facilities and raw data feeds, which are typically not accessible for smaller firms
and retail investors as they are not able to make the required investments.
• Disadvantage to smaller firms and investors.
• Some HFT firms often enter trades just for the liquidity rebate, but this adds no value to
the retail or long-term investor.
Technology as an Enabler

The emergence of HFT can be largely attributed to the technological


advancements made over the last few years.
Two key elements that have made HFT a possibility and that are most
critical for its success are:

Low latency and latency arbitrage


Systems experience a time delay, or latency, when messages and data
are processed and transmitted.
Over the last several years, trading firms have been working to ensure
that their systems have as low latency as possible, allowing them to
receive and process information as fast, or faster, than their
competitors.

Algorithms as competitive differentiators:


High frequency trading is carried out by computers. Computers are
instructed based on a series of algorithms which are developed by
firms to match their trading strategies and represent competitive
differentiators and are critical to the success of their firms.

High barrier of entrance


The primary tools used for latency arbitrage
latency arbitrage is the practice of leveraging the small time differences in the
broadcasting of pricing data by trading a financial instrument on the basis of a decision
that is driven by data received slightly ahead of other market participants.

Co-Located Servers: By cutting down the physical distance between their trading
server and the exchange server, firms ensure that the latency in data transfer between
the two points is minimized. Therefore several HFT firms purchase real estate as close
as possible to securities exchanges, and place the servers of their trading systems in
rented racks belonging to co-location providers.
• the speed of light is becoming a bottleneck for HFT traders to execute trades at a
global level. Traders would like information to flow as fast as possible.
• the optimal point to exploit the price difference between the New York Stock
Exchange and the London Stock Exchange was found to be at a spot in the mid-
Atlantic ocean. Given that infrastructure in the form of undersea data cables
already exists, such floating trade centers could be a possibility in the future.

Raw Data Feeds:


Several exchanges offer individual data feeds consisting of their own best-priced
quotations and other trade-related information. The process of consolidating this data
creates some latency and by the time the data reaches the market participants it is
already slightly old.
• several HFT firms prefer using raw, individual data feeds which saves them from
this latency.
Algorithms as
Competitive
Differentiators
Along with low latency, HFT firms require smarter algorithms that are
updated constantly to outperform the competition. The two main reasons
are:

Market Changes
HFT strategies are based on interpretation of market events and news, and
rely on the correlations between several factors such as pricing, interest rates,
and different markets events.
• need for traders to constantly upgrade their algorithms as their underlying
assumptions change based on various market events.

Reverse engineering
The shelf life of most algorithms remains limited as competitor firms are
generally able to decipher each other’s strategies through reverse
engineering.
• The firms must constantly update and upgrade their strategy.
• Technological innovations have made the frequent upgrades of algorithms
much easier and far more economical than they were in the recent past.
Factors Contributing to Low Latency
New technology has helped to lower the latency

Fiber Optics:
• fiber optics have replaced traditional copper wires for long- distance
network communication
• sharing information between firms across continents much faster.
• recently also possibility to physically shorten the length of cables
- > further reduction in transmission time.
Bandwidth: increased bandwidth - > more information and faster

Field Programmable Gate Arrays (FPGAs): FPGAs are integrated circuits


typically used in high performance computing, and have only recently
been adopted by the financial services industry as a technology. Firms
configure FPGAs to perform specific functions from their algorithms in a
repetitive and quick manner, leading to lower latency.
Low latency is a relative phenomenon as improvements in technology
are constantly bringing down latency levels. What is low?
Regulation
How to ensure robust and fair markets?

• Are markets more or less efficient than in the past? Why do we need to
trade on a millisecond timescale?
• Should we have such a fragmented market? Market integrity could be
endangered when technological advantage is misused for abusive tactics
(e.g., by manipulating the price discovery process through excessive order
entries and/or cancellations).

• Financial markets could become exposed to systemic risks as a result of


technical vulnerability (malfunctioning algorithms), self-reinforcing
strategies, and/or overload of technical systems.

• Are market structures like dark pools beneficial?

How can we ensure market stability?


• Circuit breakers? Minimum order life span? Transaction taxes? Periodic
auctions?
Some proposals
• Risk controls (circuit breakers) to be adopted by trading venues
provided they are properly calibrated in cooperation with market
participants and consistent across venues.

• Adoption of minimum tick sizes, calibrated by reference to price


and levels of liquidity.

• Co-location facilities to be made available on a non-discriminatory


basis.

• Some unrealistic proposals:


– Artificially limiting execution speed on trading venues.
– Minimum life-time for quotes before they can be cancelled or
modified.

Despite its increasing popularity and rapid adoption,


HFT faces a number of challenges,
primary among which is the threat of new regulations which could
alter the way HFT trades are executed today.
HFT trading is more correlated
than human
For Curiosity:
90 -95 % of the telecommunication goes via submarine data cables.
There are plans for a new cable connecting Europe and Far East via Finland (or
Norway) and the Northeast passage.
• time from Berlin to Tokyo would shrink ¼.
• with existing connections time from Tokyo to Helsinki is 247 ms
-> vie Northeast passage the time (latency) would be 153 ms.

You might also like