Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Order book dynamics in high frequency trading

5,434 views

Published on

An important task of high-frequency trading is to successfully capture the dynamics in the Data. Empirical Data on Indian Exchanges show that 95% of all NEW orders are placed within 5 ticks of best-bid and best-ask. The Quantinsti® Replacement Matrix shows that most of the orders that are being replaced are among the top 3 levels and these replacements allow us to visualize and generalize about market behaviour. This matrix gives a visual representation of the cost metrics and replacement behaviour.

Execution Algorithms provide a price which is between Limit Order Execution and Market Order Execution. Market Orders guarantee execution within a certain time but the price that it may get the trader remains uncertain. Limit Order guarantees the price but it may remain un-executed if price moves away. Most Execution Algorithms balance between these two order types.

The speaker, Mr. Gaurav Raizada, discusses Quantinsti® Replacement Matrix in the webinar along with basics on order book management theory for high frequency traders.

Published in: Economy & Finance
  • Be the first to comment

Order book dynamics in high frequency trading

  1. 1. 1 Gaurav Raizada, Director at iRageCapital Advisory Pvt. Ltd. Faculty at QuantInsti Quantitative Learning Pvt. Ltd. 02-JUNE -2015 Mumbai Order Book Dynamics in High Frequency Trading
  2. 2. 2 Limit Order Book • Indian exchanges are order-driven markets. • Most newly organized trading systems are electronic order-driven markets. • All order-driven markets use order precedence rule and trade pricing rule. Workshop on Algorithmic & High Frequency Trading
  3. 3. 3 Resolution Parameters of LOB • Lot Size- Smallest Quantity Order that can be placed in Order Book • The tick size - All orders must arrive with a price that is specified to the precision of a tick size. • The best bid price - highest price among active buy orders • The best ask price - lowest price among the active sell orders. • The bid-ask spread - difference between the best ask and the best bid Workshop on Algorithmic & High Frequency Trading
  4. 4. 4 Order Precedence Rules • Price priority – Should a trader be allowed to bid below the best bid, above the best ask? • Time precedence – Is time precedence maintained for subsequent orders at the best bid or offer? Why? Why not? – How can a trader keep his bid or offer “live”? – The minimum tick size is the price a trader has to pay to acquire precedence. Workshop on Algorithmic & High Frequency Trading
  5. 5. 5 More on Price Precedence • Price priority o Market orders always rank above limit orders. o Limit buy orders with high prices have priority over limit buy orders with low prices o Limit sell orders with low prices have priority over limit sell orders with high prices. Workshop on Algorithmic & High Frequency Trading
  6. 6. 6 Time Precedence • Under time precedence, the first order at a given price has precedence over all other orders at that price. Gives orders precedence according to their time of submission. • The pure price-time rule uses only price priority and time precedence. Workshop on Algorithmic & High Frequency Trading
  7. 7. 7 Order Types Exchanges support various order types in order to cater to needs of traders and investors. The order types can be broadly divided into the following categories – • Time Conditions • Price Conditions • Other (including conditionality) Conditions Workshop on Algorithmic & High Frequency Trading
  8. 8. 8 Time Conditions • GTC - A Good Till Cancelled (GTC) order is an order that remains in the system until it is cancelled by the Trading Member. • GTD - A Good Till Days/Date (GTD) order allows the Trading Member to specify the days/date up to which the order should stay in the system. At the end of this period the order will get flushed from the system • Day Order: A day order is valid for the day on which it is entered. If the order is not executed during the day, the system cancels the order automatically at the end of the Day. • Immediate or Cancel (IOC) Order: An IOC order allows the user to buy or sell as soon as the order is released into the system, as long as the price conditions are matched. Workshop on Algorithmic & High Frequency Trading
  9. 9. 9 Price Conditions • Market Price: Market orders have no price specified at the time order is released into the system. For a Buy Market Order, the system matches the Sell Limit Orders in the Order Book and for the Sell Market Order; system matches the Buy Limit Orders. • Limit Price: An order to buy a specified quantity of a security at or below a specified price, or an order to sell it at or above the specified price. This ensures that the participant never pays a worse price than the limit price set. • Stop loss: This order type allows the participant to release an order into the system after the market price of the security reaches or crosses a threshold price. Workshop on Algorithmic & High Frequency Trading
  10. 10. 10 Market Orders • If a Sell Market Order of size 500 hits the order book at this instant, then, it will cross with Limit Orders of Bid Price 82.75. Bid Size Bid Price Ask Price Ask Size 600 82.75 82.90 23 152 82.65 83.00 300 212 82.60 83.15 143 53 82.55 83.20 512 200 82.50 83.25 45 Bid Size Bid Price Ask Price Ask Size 100 82.75 82.90 23 152 82.65 83.00 300 212 82.60 83.15 143 53 82.55 83.20 512 200 82.50 83.25 45 Workshop on Algorithmic & High Frequency Trading
  11. 11. 11 Limit Orders • If a Buy Limit Order of Price 82.75, size 100 is added to the Order Book then Order Book is changed to the following Bid Size Bid Price Ask Price Ask Size 600 82.75 82.90 23 152 82.65 83.00 300 212 82.60 83.15 143 53 82.55 83.20 512 200 82.50 83.25 45 Bid Size Bid Price Ask Price Ask Size 700 82.75 82.9 23 152 82.65 83 300 212 82.6 83.15 143 53 82.55 83.2 512 200 82.5 83.25 45 Workshop on Algorithmic & High Frequency Trading
  12. 12. 12 Characterization of Execution Algorithms Time Uncertain Time Certain Price Certain Price Uncertain Market Order Limit Order Other Execution Algorithms Workshop on Algorithmic & High Frequency Trading
  13. 13. 13 Empirical - Relative Price • In Indian data, it is observed that most orders arrive at best bid and ask • Close to 95% of all new orders placed in the exchange are within 5 ticks of the best bid and ask • This could be due to Order to Trade Ratio regulations on Indian Exchanges. Workshop on Algorithmic & High Frequency Trading
  14. 14. 14 The Relative Price Distribution in terms of Ticks from Best Bid and Best Ask 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 -6 -5 -4 -3 -2 -1 1 2 3 4 5 6 Workshop on Algorithmic & High Frequency Trading
  15. 15. 15 Replace Transition Mechanism ASK BID 100 95 91 97 Current Order - 5 Ticks from the ASK Current Order - 2 Ticks from the ASK This is (-3, 5) Transition Workshop on Algorithmic & High Frequency Trading
  16. 16. 16 Replacement Transitions • What does a (-3,3) mean • Replace to Trade from Order at (ASK – 3 Ticks) to ASK. • What does a (0,1) mean • Replace at Best Bid to Best Bid itself • What does (0,2) mean • Replace from (ASK – 2 Ticks) to (ASK – 2 Ticks) • What does (1,1) mean • Replace from (ASK -1 Ticks) to (ASK – 2 Ticks) Workshop on Algorithmic & High Frequency Trading
  17. 17. 17 Replacement Matrix 1 2 3 4 5 6 7 8 9 -5 0.019 0.012 0.009 0.008 0.007 -4 0.012 0.021 0.024 0.030 0.016 0.013 -3 0.018 0.024 0.004 0.006 0.003 0.003 0.001 -2 0.014 0.022 0.006 0.039 0.039 0.041 0.009 0.006 -1 0.008 0.026 0.004 0.031 0.003 0.028 0.023 0.021 0.009 0 0.002 0.004 0.033 0.031 0.008 1 0.039 0.037 0.029 0.006 2 0.030 0.026 3 0.014 4 0.012 5 6 7 8 9 10 ReplaceTicks Ticks from ASK Workshop on Algorithmic & High Frequency Trading
  18. 18. 18 Volumes Shares Order Ratios Colo Non-Colo Trade Ratios Colo Non-Colo Workshop on Algorithmic & High Frequency Trading
  19. 19. 19 Developments at National Stock Exchange • Broadcast • TCP Tick by Tick • Multicast Tick by Tick • Trade Execution Ranges Workshop on Algorithmic & High Frequency Trading
  20. 20. 20 • Movement to New Exchange Technology • Trades at 200 microseconds • EMDI/EOBI Tick by Tick Streams • Direct FIX connectivity (earlier IML Technology) • Self Trade Prevention Checks Developments at National Stock Exchange Workshop on Algorithmic & High Frequency Trading
  21. 21. 21 Vicious Cycle More Volumes Lower Costs More Opportunities Higher volumes lead to gains in efficiency through the use of technology, leading to lower transaction costs. Technology is the enabler of the virtuous cycle, but cost is the driver. As costs approach zero, volumes will peak as a result. Workshop on Algorithmic & High Frequency Trading
  22. 22. 22 Statistical Arbitrage Reliance Futures Reliance Put/Call Sensex Put/Call Sensex Futures Reliance Stock Statistical correlations arise because securities are driven by systematic factors such as inflation, regulatory policies, currency prices, economic growth, and so on. Because there are far fewer systematic drivers than there are securities which depend on them, correlation between securities is guaranteed to exist! Workshop on Algorithmic & High Frequency Trading
  23. 23. 23 Structural vs. Statistical Correlations  Structural correlations tend to be strong, steady, & robust  Profitable opportunities tend to be very easy to identify, and are thus heavily competed for.  Competition prevents structural price divergences from growing large – Small bets  Tremendous speed is required in order to access them before competitors  Mainstay of HFTs, who specialize in fast trading  Statistical correlations tend to be weak, time-varying, and non- stationary  Profitable opportunities based on statistical correlations tend to be harder to model, and more persistent in terms of their duration  Size and duration of these opportunities facilitates large bet- sizes and overnight positioning  Such opportunities tend to be favoured by large quantitative hedge funds specializing in statistical analysis Workshop on Algorithmic & High Frequency Trading
  24. 24. 24 Introduction of New Instruments • ETFs • Interest Rate Futures • VIX Futures • Strategy ETFs ?? • Bonds ?? • Credit Instruments Workshop on Algorithmic & High Frequency Trading
  25. 25. 25 It's the Latency, Stupid Well known and referenced article “a network link with low bandwidth can be made better with money, but network link with bad latency cannot be helped” This was the scene in 1996, when bandwidth was the constraint. Speeds were in Kbps. Cheshire later become Wizard at Apple. Pioneering Zeroconf http://rescomp.stanford.edu/~cheshire/rants/Latency.html Workshop on Algorithmic & High Frequency Trading
  26. 26. 26 Misnomer – Bad Terminology Would you say that a Boeing 747 is three times "faster" than a Boeing 737? Of course not. They both cruise at around 500 miles per hour. The difference is that the 747 carries 500 passengers where as the 737 only carries 150. The Boeing 747 is three times bigger than the Boeing 737, not faster. Now, if you wanted to go from New York to London, the Boeing 747 is not going to get you there three times faster. It will take just as long as the 737. In fact, if you were really in a hurry to get to London quickly, you'd take Concorde, which cruises around 1350 miles per hour. It only seats 100 passengers though, so it's actually the smallest of the three. Size and speed are not the same thing. On the other hand, If you had to transport 1500 people and you only had one aeroplane to do it, the 747 could do it in three trips where the 737 would take ten, so you might say the Boeing 747 can transport large numbers of people three times faster than a Boeing 737, but you would never say that a Boeing 747 is three times faster than a Boeing 737. Workshop on Algorithmic & High Frequency Trading
  27. 27. 27 System Architecture of an Automated Trading System • With the advent of DMA & automated trading, the following changes in architecture took place: – Latency between Event Occurrence & Order Generation had to be reduced to an order of milliseconds and lower. – Order Management had to be made more robust to handle generation of thousands of orders in a second – Risk Management had to be done in real time and without human intervention Workshop on Algorithmic & High Frequency Trading Workshop on Algorithmic & High Frequency Trading
  28. 28. 28 Introduction to low latency • Technology – State of Art • Approach to latency improvement • Latest in Low Latency -approaches and technologies being deployed to achieve low latency Workshop on Algorithmic & High Frequency Trading
  29. 29. 29 Why aim for Low Latency or Lowest ? • It may be necessary to lower latency just to remain competitive • The strategy demands low latency, perhaps. • It may be desirable to improve latency to stop getting picked off by competitors • With introduction of Colocations and increasing focus in remaining fastest in the market, significant capital is invested. However it can all go waste, if correct technology is not identified and implemented. • The issue is that latency is difficult to quantify. As a result the value of latency improvement, though easily understood, is extremely difficult to quantify • Lower latency systems cost a lot more to build and deploy. Hence the objective should be to find the right balance between investment and return on investment in low latency Workshop on Algorithmic & High Frequency Trading
  30. 30. 30 Latencies – Strategy wise Citihub, 2009 Workshop on Algorithmic & High Frequency Trading
  31. 31. 31 Latency by Distance Workshop on Algorithmic & High Frequency Trading
  32. 32. 32 Microbursts Workshop on Algorithmic & High Frequency Trading
  33. 33. 33 Corvil Analysis “For this feed, how much bandwidth is needed to protect 99.99% of packets from loss with no more than 100 microseconds of latency to be experienced during the busy 1 second of the trading day” Workshop on Algorithmic & High Frequency Trading
  34. 34. 34 Latency Recommendations Workshop on Algorithmic & High Frequency Trading
  35. 35. 35 Technology Mix Workshop on Algorithmic & High Frequency Trading
  36. 36. 36 Tips • Servers – Fastest Cores, Cache, • Operating Systems – RT kernels • Fastest Network Infra (Switches, Routers ) • Retune the TCP stack • Program Runtime – isolcpus, stack bypass • Solid State Drives • Latency Tuning – TCP_NODELAY, sendfile(2), Lock Free Codes Workshop on Algorithmic & High Frequency Trading
  37. 37. 37 Sample Solution Path Workshop on Algorithmic & High Frequency Trading
  38. 38. 38 Thank You! To Learn Automated Trading Email: contact@quantinsti.com Connect With Us: SINGAPORE 11 Collyer Quay, #10-10, The Arcade, Singapore - 049317 Phone: +65-6221-3654 INDIA A-309, Boomerang, Chandivali Farm Road, Powai, Mumbai - 400 072 Phone: +91-022-61691400

×