EXANTE's lecture at Stockholm School of Economics in Riga.
– Objectives of algorithmic trading
– Various types of algorithms
– The process of creating one
– Testing and evaluation
– Understanding the possible pitfalls (and solutions)
2. All the buzz..
Algo-trading
Automated trading systems
High Frequency Trading/Low Latency
Trading
Black box
Robots
50-85% of traded volume in US stocks is
generated by robots
Flash crash
Robots take advantage of true investors?
4. What are the objectives?
Smart execution/Hedging (min costs)
Automating a strategy (make profit)
5. What are the objectives?
Smart execution/Hedging (min costs)
Automating a strategy (make profit)
Brokers, Asset managers, etc.
Used when placing large orders
Disclosing information from the market
Minimizing the impact on the price
6. Smart execution
Example:
Need to buy 100’000 shares of L’Oreal stock
a) Place all in one order
b) Divide into 100 orders, 1000 shares each
c) Divide into 100 orders, 1000 shares each
and place one every 5 minutes
7. What can be done?
TWAP
VWAP
Percentage of Volume (POV)
Minimal Impact (dark pools)
Cost driven
Other
8. What can be done?
TWAP
VWAP
Percentage of Volume (POV)
Minimal Impact (dark pools)
Cost driven
Other
Time Weighted Average Price
Attempt to match price over time
100’000 shares over 5hrs = 5’000 shares every 15 minutes
Possible improvements:
- more flexible schedule
- make it less predictable
9. What can be done?
TWAP
VWAP
Percentage of Volume (POV)
Minimal Impact (dark pools)
Cost driven
Other
Volume Weighted Average Price
Large volume transaction have more impact on benchmark
price
Every 15 minutes place an order with a proportional size to
the traded volume
Relies on Historical trading volumes
11. What can be done?
TWAP
VWAP
Percentage of Volume (POV)
Minimal Impact (dark pools)
Cost driven
Other
Example - trade 10% of each market trade
A stock with original daily turnover of 1’000’000 shares
should result in execution of 100’000 shares
More dynamic than TWAP & VWAP
12. What can be done?
TWAP
VWAP
Percentage of Volume (POV)
Minimal Impact (dark pools)
Cost driven
Other
Dark Pools - private exchanges for trading securities
Not available to general public
No transparency
Came about to facilitate block trades when we want to
minimize market impact
Liquidity in Dark Pools is limited, thus usually combined with
other strategies
Other options: broker’s internal crossing networks, hidden
order types (iceberg)
13. What can be done?
TWAP
VWAP
Percentage of Volume (POV)
Minimal Impact (dark pools)
Cost driven
Other
Trading too aggressively may result in considerable market
impact, while trading too passively incurs timing risk
Balancing impact and timing
Very poor liquidity / huge bid-ask spread
Factors:
- order size
- time available for trading
- asset specific (liquidity and volatility)
- investor’s urgency or risk aversion
14. What can be done?
TWAP
VWAP
Percentage of Volume (POV)
Minimal Impact (dark pools)
Cost driven
Other
Wait for specific market conditions
More advanced/opportunistic algorithms
- Momentum detection
Hire someone to do it! Execution Services
15. What are the objectives?
Smart execution (min costs)
Automating a strategy (make profit)
Market making
Statistical arbitrage
Front running
Outsmarting the others
16. Automating a Strategy
Market Making
Statistical Arbitrage
Front Running
Outsmarting the others
Keep Best Bid and Best Ask in the market
Earn few cents per transaction
Some exchanges offer rebates
Improves the market
Provides liquidity
Must be very smart about risk management
Think - casino/online poker
18. Automating a Strategy
Market Making
Statistical Arbitrage
Front Running
Outsmarting the others
Over long period of time/many transactions statistically gives
near riskless profit
Pair/Spread trading (Pepsi vs Coke, Stock vs Industry,
fungible commodities)
Comparing Index(ETF) to basket
Mean reversion
20. Automating a Strategy
Market Making
Statistical Arbitrage
Front Running
Outsmarting the others
Guerilla algorithms to find Icebergs(liquidity):
- Probabilistic models
- Compare actual trades vs order book
- Identify patterns
HFT & price forecasting
Signal/News trading
Abusive strategies: e.g. flooding the system with orders to
lower the latency for others
21. Automating a Strategy
Market Making
Statistical Arbitrage
Front Running
Outsmarting the others
Pattern recognition:
- Price/Volume /Order Book
- Finding other algos (reverse engeneering)
Market sentiment (e.g. processes Twitter mood)
Fair price (derivatives)
Be crative!
22. The Cycle of Automating a Strategy
1) Idea
2) Quantify the idea, Prototype an algorithm
3) Backtest
4) Test in safe environment
5) Production version/Babysitting
6) Constant improvement
23. The Cycle of Automating a Strategy
1) Idea
2) Quantify the idea, Prototype an
algorithm
3) Backtest
4) Test in safe environment
5) Production version/Babysitting
6) Constant improvement
Gut feeling or a practice
Often comes from competence in other fields
(market, sector, technology, processes…)
General ideas are simple and public, it’s often
the details and parameters that make the
difference
24. The Cycle of Automating a Strategy
1) Idea
2) Quantify the idea, Prototype
an algorithm
3) Backtest
4) Test in safe environment
5) Production version/Babysitting
6) Constant improvement
Math : Trivial ~ Hardcore
Building the correct model
Example:
Momentum following
Idea: security on an uptrend/downtrend will
continue on an uptrend/downtrend
Implementation: take 1st and 2nd derivative of
moving average, trade when specific threshold
1st/2nd is crossed
25. The Cycle of Automating a Strategy
1) Idea
2) Quantify the idea, Prototype an
algorithm
3) Backtest
4) Test in safe environment
5) Production version/Babysitting
6) Constant improvement
Getting good data (can be extremely expensive)
Overfitting - can the past results be applied in
the future trading
Defining parameters/Testing them
Risk evaluation (Sharpe ratio, Draw down,
Expected shortfall, Value at Risk)
Is the idea profitable?
26. The Cycle of Automating a Strategy
1) Idea
2) Quantify the idea, Prototype an
algorithm
3) Backtest
4) Test in safe environment
5) Production version/Babysitting
6) Constant improvement
Test on Demo/other assets/extremely small
amounts
Finding bugs
Detecting corner cases
What about trading costs?
Is it still profitable?
27. The Cycle of Automating a Strategy
1) Idea
2) Quantify the idea, Prototype an
algorithm
3) Backtest
4) Test in safe environment
5) Production
version/Babysitting
6) Constant improvement
Close to impossible to simulate the actual
market
Quality of execution (slippage)
Speed
Interaction with other algos/impact on market
Is it still profitable?
Identify the problems if not
28. The Cycle of Automating a Strategy
1) Idea
2) Quantify the idea, Prototype an
algorithm
3) Backtest
4) Test in safe environment
5) Production version/Babysitting
6) Constant improvement
Markets are constantly changing
New participants, new competitors
Strategies often stop being profitable after a
while
29. Dangers of Algo-trading
Robots do not understand if they’re doing something wrong, lots of pressure on
the design (security, controls, limits…)
More and more reliability on IT (networks, servers, hardware, data feed, latency)
Very small margin of error
Keeping your idea secret and protected
The field is still rather new and proper regulation is being drafted as we speak
Due to the above, there is a risk of systemic failures