borsa i̇stanbul itch protocol specification rules of
Transcription
borsa i̇stanbul itch protocol specification rules of
BORSA İSTANBUL ITCH PROTOCOL SPECIFICATION RULES OF ENGAGEMENT December 30, 2014 Version 1.2 ©2014 Borsa İstanbul A.Ş., All rights reserved DOCUMENT HISTORY Date Version Description of changes July 7, 2014 September 19, 2014 1.0 1.1 December 30, 2014 1.2 © 2014 Borsa İstanbul A.Ş. First release. LastSeqNum field is added to Heartbeat message. Requested Sequence Number field is updated in section “3.1.2.1 Login Request Packet” 2 TABLE OF CONTENTS 1. INTRODUCTION ............................................................................................................................... 5 1.1 PURPOSE ................................................................................................................................. 5 1.2 TARGET AUDIENCE .................................................................................................................. 6 2. ITCH ................................................................................................................................................. 6 2.1 ARCHITECTURE ........................................................................................................................ 7 2.1.1 HEADER ........................................................................................................................... 7 2.1.2 MESSAGE BLOCK ............................................................................................................. 7 2.2 DATA TYPES ............................................................................................................................. 8 2.3 MESSAGE FORMATS ................................................................................................................ 9 2.3.1 HEARTBEAT ..................................................................................................................... 9 2.3.2 TIME MESSAGES ............................................................................................................ 10 2.3.3 REFERENCE DATA MESSAGES ....................................................................................... 11 2.3.4 EVENT AND STATE CHANGE MESSAGES ....................................................................... 14 2.3.5 ORDER LEVEL DATA ....................................................................................................... 17 2.3.6 TRADE MESSAGES ......................................................................................................... 22 2.4 PROTOCOL FLOW .................................................................................................................. 23 2.5 HOW TO BUILD AN ORDER BOOK VIEW ............................................................................... 25 2.6 SAMPLE SCENARIOS .............................................................................................................. 27 2.6.1 CASE 1 ........................................................................................................................... 27 2.6.2 CASE 2 ........................................................................................................................... 27 2.6.3 CASE 3 ........................................................................................................................... 27 2.6.4 CASE 4 ........................................................................................................................... 28 2.6.5 CASE 5 ........................................................................................................................... 28 3. GLIMPSE ........................................................................................................................................ 29 3.1 ARCHITECTURE ...................................................................................................................... 29 3.1.1 LOGICAL PACKETS SENT BY SERVER .............................................................................. 29 3.1.2 LOGICAL PACKETS SENT BY CLIENT ............................................................................... 31 3.2 DATA TYPES ........................................................................................................................... 32 3.3 MESSAGE FORMATS .............................................................................................................. 32 3.3.1 END OF SNAPSHOT MESSAGE ....................................................................................... 32 3.4 PROTOCOL FLOW .................................................................................................................. 33 4. REWINDER..................................................................................................................................... 34 4.1 ARCHITECTURE ...................................................................................................................... 34 4.1.1 LOGICAL PACKETS SENT BY SERVER .............................................................................. 35 4.1.2 LOGICAL PACKETS SENT BY CLIENT ............................................................................... 36 4.2 DATA TYPES ........................................................................................................................... 37 4.3 MESSAGE FORMATS .............................................................................................................. 37 © 2014 Borsa İstanbul A.Ş. 3 4.4 PROTOCOL FLOW .................................................................................................................. 37 © 2014 Borsa İstanbul A.Ş. 4 1. INTRODUCTION The message protocol of ITCH is widely used and considered an industry standard. ITCH™ is a registered service mark of the NASDAQ OMX Group. ITCH™ is the ultra-low latency protocol for accessing Borsa İstanbul Equity Market Data. ITCH has been developed to maximize performance and so meet the requirements of latency sensitive traders. GLIMPSE™ is a point-to-point data feed connection that provides direct data feed customers with a snapshot of the current state of the order books traded in the trading system. GLIMPSE uses the same message formats as ITCH. GLIMPSE can be used to quickly sync up with the ITCH feed. Clients must start listening to the real-time ITCH channel first. Then at the end of the GLIMPSE snapshot, a sequence number is provided that can be used to connect and sync up with the real-time ITCH feed. REWINDER™ is a point-to-point data feed connection that provides tick-by-tick missing data. REWINDER is utilized if a sequence number gap is detected. NOTE: OUCH™ is an order entry protocol supported by the NASDAQ OMX Group. OUCH™ only provides a method for participants to send orders and receive updates on those orders entered. For information about all orders entered into and executed on the book, refer to the ITCH™ protocol (available separately). Borsa İstanbul does not provide OUCH order entry. Borsa İstanbul co-location customers only send FIX protocol based orders and get market data via ITCH. 1.1 PURPOSE This document explains access to the market data of Borsa İstanbul Equity Market via the ITCH protocol for Borsa İstanbul co-location customers. Borsa İstanbul new data center is scheduled to open in the summer of 2014. This data center is located in Borsa İstanbul İstinye campus and offers the same network facilities with trading systems to co-location customers. A low-latency trading infrastructure is a must for high-frequency trading (HFT) for algo-traders. This document describes the flow and specifies application messages. © 2014 Borsa İstanbul A.Ş. 5 1.2 TARGET AUDIENCE The information provided by this document is relevant for IT staff responsible for performing the implementation of ITCH application. For further information and inquiries regarding market data or for questions concerning ITCH connectivity, please contact Borsa İstanbul Technical Support via email to: bt-destek@borsaistanbul.com Further copies of this document can also be downloaded from Borsa İstanbul website http://www.borsaistanbul.com/uyeozel/SoftwareAndDocuments/pay-piyasalari 2. ITCH ITCH is a direct data feed product. The ITCH feed displays all public orders and trades. ITCH features the following data elements: Order level data: The system will provide its full order depth using the standard ITCH format. ITCH uses a series of order messages to track the life of a customer order, including order executions. Trade messages: ITCH supports a trade message to reflect a match of a non-displayable order in the system. Reference Data: - Order Book Directory messages provide basic security data. - Tick Size Table Entry messages convey Tick Sizes for order books. Event controls, such as the states of the different order books. - Order Book State message to inform receivers of state changes. NOTE: ITCH does not provide; - Order entry (Co-lo customers can use FIX protocol for order entry protocol. OUCH is not supported by Borsa İstanbul.) Market-by-price (MBP) data feed. (ITCH makes it possible for subscribers to track the status of each order from the time it is first entered until the time it is either executed or canceled.) Privately negotiated (special terms of orders) trades feed. © 2014 Borsa İstanbul A.Ş. 6 2.1 ARCHITECTURE ITCH Gateway sends “downstream” packets that are received by clients. Each packet consists of a “Downstream Packet Header” and a series of “Message Blocks”. The Message Blocks carry the actual data of the stream. The ITCH feed is made up of a series of sequenced messages. Each message is variable in length based on the message type. The ITCH packet can be maximum 1024 bytes. Every ITCH Packet: Downstream Header (20 bytes) + Message Blocks (variable bytes) 2.1.1 max 1024 bytes HEADER DOWNSTREAM PACKET HEADER NAME OFFSET LENGTH VALUE NOTES Session 0 10 Alpha Not used by Borsa İstanbul. Sequence Number 10 8 Numeric The sequence number of the first message in the packet. If there is more than one message contained in a packet, any messages following the first message are implicitly numbered sequentially. For Heartbeat message, sequence number is always set to 0. Message Count 2.1.2 18 2 Numeric The count of messages contained in this packet. MESSAGE BLOCK The first field of a Message Block is the two byte Message Length. The remainder of the Message Block is the variable length Message Data field. The first Message Block field will always start immediately following the Header which is 20 bytes (10+8+2) from the beginning of the packet. Subsequent Message Blocks will begin after the last byte of the previous Message Block. Message Block contains variable message data which are defined at message count field in header. © 2014 Borsa İstanbul A.Ş. 7 DOWNSTREAM PACKET MESSAGE BLOCK NAME OFFSET LENGTH VALUE NOTES Message Length * Numeric Indicates the length in bytes of the message contained in this Message Block. 2 The Message Length is an unsigned binary count representing the number of message data bytes following this Message Length field. The message length field value does not include the two bytes occupied by the message length field. The total size of the message block is the value of the message length field plus two. Message Data * * Alpha The Message Data is the actual data of the message being transmitted by server. It is variable in length and can be zero length. The meaning of the data is application specific. * Variable values 2.2 DATA TYPES All Numeric fields are composed of big-endian binary encoded numbers. All alpha fields are left justified and padded on the right with spaces. The Alpha fields are composed of non-control ISO 8859-1 (Latin-1) encoded bytes. Timestamps are represented as nanoseconds since midnight. DATA TYPES TYPE SIZE NOTES Numeric 1, 2, 4 or 8 bytes Unsigned big-endian binary encoded numbers. NOTE: Borsa İstanbul uses big-endian architecture. If the client computers use a little-endian system (Most computers, including PCs, use the little-endian system), they must convert data between the two systems. Alpha variable Left justified and padded on the right with spaces. Price 4 bytes Prices are signed integer fields. Number of decimals is specified at “Number of decimals in Price” in the “Order Book Directory (R)” message. The default number of decimals in price is always 3 digits for all price values. For example; the price value “1234” © 2014 Borsa İstanbul A.Ş. 8 DATA TYPES TYPE SIZE NOTES describes “1,234”. Exception: The “Tick Size Table Entry (L)” message contains an 8 Byte Price field instead of 4 Byte! 2.3 MESSAGE FORMATS The ITCH feed is composed of a series of messages that describe orders added to, removed from, and executed on Borsa İstanbul. It also contains messages for basic reference data of the order books as well as state changes and halts. MESSAGES LIST Categories Code Message Heartbeat H Heartbeat Time Messages T Second Message Reference Data R Order Book Directory L Tick Size Table Entry S System Event Message O Order Book State Message A Add Order E Order Executed Message U Order Replace Message D Order Delete Message P Trade Message Event & State Change Order Level Data Trade Message 2.3.1 HEARTBEAT Heartbeats are sent periodically by the ITCH server, so receivers can sense packet loss even during times of low traffic. Typically, these packets are transmitted once per 10 second. A Heartbeat packet contains only one heartbeat message. If the client does not receive anything (neither data nor heartbeats) for an extended period of time, it can assume that the link is down. For Heartbeat message, sequence number in the header is always set to 0. REWINDER and GLIMPSE do not send Heartbeat packets. © 2014 Borsa İstanbul A.Ş. 9 HEARTBEAT NAME OFFSET LENGTH VALUE NOTES Message Type 0 1 “H” H – Heartbeat Message Second 1 4 Numeric Unix time (number of seconds since 197001-01 00:00:00 UTC). (Big-endian) Timestamp – Nanoseconds 5 4 Numeric Nanoseconds portion of the timestamp. (Big-endian) LastSeqNum 9 8 Numeric Last sequence number of ITCH channel. 2.3.2 TIME MESSAGES For bandwidth efficiency, the ITCH timestamp is separated into two parts: TIMESTAMP PORTION MESSAGE TYPE NOTES Seconds Standalone message. Unix Time (number of seconds since 1970-01-01 00:00:00 UTC). Unix Time (Epoch Time or POSIX Time) is a system for describing points in time. Defined as the number of seconds (excluding leap seconds) that has elapsed since the midnight of January 1, 1970 Coordinated Universal Time (UTC). NOTE: A Timestamp – Second message will be disseminated for every second for which there is at least one message. Nanoseconds Field within individual messages. Reflects the number of nanoseconds since the most recent Timestamp-Seconds message that the data message was generated. A nanosecond (ns) is an SI unit of time equal to one billionth of a second. 10-9 s or 1/1,000,000,000 s © 2014 Borsa İstanbul A.Ş. 10 2.3.2.1 SECOND MESSAGES This message is sent every second, for which at least one ITCH message is generated. The message contains the number of seconds since the start of 1970-01-01 00:00:00 UTC, also called Unix Time. TIMESTAMP – SECONDS MESSAGE NAME OFFSET LENGTH VALUE NOTES Message Type 0 1 “T” T - Second Message. Second 1 4 Numeric Unix time (number of seconds since 197001-01 00:00:00 UTC). (Big-endian) 2.3.2.1.1 SAMPLE MESSAGE T|1071934401 2.3.3 REFERENCE DATA MESSAGES 2.3.3.1 ORDER BOOK DIRECTORY At the start of each trading day, Order Book Directory messages are disseminated for all active securities, including halted securities, in Borsa İstanbul trading system. NOTE: An Order Book Directory message will occur when new order books (securities) are added to the system between the first and the second sessions, during lunch break. Updates to existing order books will also be represented by intra-day Order Book Directory messages. ORDER BOOK DIRECTORY NAME OFFSET LENGTH VALUE NOTES Message Type 0 1 “R” R - Order Book Directory Message Timestamp – Nanoseconds 1 4 Numeric Nanoseconds portion of the timestamp. (Big-endian) Order book ID 5 4 Numeric Denotes the primary identifier of an order book. Symbol 9 32 Alpha Security short name. Long Name 41 32 Alpha Only warrant long name. © 2014 Borsa İstanbul A.Ş. 11 ORDER BOOK DIRECTORY NAME OFFSET LENGTH VALUE NOTES Stock Market 73 Alpha Values: 12 N=National L=Second National W=Watchlist K=Collective Products, S=Free Trade Platform, G=Emerging Companies Financial Product 85 1 Numeric (Suffix) Values: 1=Old Market ("E") 6=Rights Coupon Market ("R") 7=Exchange Traded Funds ("F") 8=Warrants Market ("V") 9=Certificate Market ("C") NOTE: Primary Market(IPO), Buyin and Offical Auction products are not available in ITCH. Trading Currency 86 3 Alpha Trading currency. NOTE: Default value is “TRY”. Number of decimals in Price 89 2 Numeric This value defines the number of decimals used in price for this order book. NOTE: Default value is 3. NOTE: Number of decimals is specified in the Order Book Directory message and valid for all price values. Number of decimals in Nominal Value 91 2 Numeric Not used by Borsa İstanbul. Reserved 93 4 Alpha Not used by Borsa İstanbul. Reserved 97 4 Alpha Not used by Borsa İstanbul. Reserved 101 4 Alpha Not used by Borsa İstanbul. Nominal Value 105 8 Numeric Not used by Borsa İstanbul. 2.3.3.1.1 SAMPLE MESSAGE R|392557824|2207822 |ACSEL © 2014 Borsa İstanbul A.Ş. | |L |E|TRY|3|0| | | |0 12 2.3.3.2 TICK SIZE TABLE ENTRY This message contains information on a tick size for a price range. Each Order Book has a set of Tick Size Table Entries to define its tick size table. The price range is calculated by using the base price of a security and the Order Book always has one Tick Size Table. NOTE: The numbers of decimals in prices are given in the “Number of decimals in Price” value by the Order Book Directory message for this Order Book. The default number of decimals in price is always 3 digit for all price values. TICK SIZE TABLE ENTRY NAME OFFSET LENGTH VALUE NOTES Message Type 0 1 “L” L – Tick Size Message Timestamp – Nanoseconds 1 4 Numeric Nanoseconds portion of the timestamp. Order book ID 5 4 Numeric The order book to which this entry belongs. Tick Size 9 8 Price Tick Size for the given price range Price From 17 4 Price Start of price range for this entry. (LowLimitPrice) NOTE: Zero (0) means free float (there is no lowest and highest price according to the related rules). NOTE: Number of decimals is specified in the Order Book Directory message and is valid for all price values. Price To 21 4 Price End of price range for this entry. (HighLimitPrice) NOTE: Zero (0) means free float (there is no lowest and highest price according to the related rules). NOTE: Number of decimals is specified in the “Number of Decimals in Price” value in the Order Book Directory message and is valid for all price values. 2.3.3.2.1 SAMPLE MESSAGE L|392557824|2207822|100|84250|103250 © 2014 Borsa İstanbul A.Ş. 13 2.3.4 EVENT AND STATE CHANGE MESSAGES 2.3.4.1 SYSTEM EVENT MESSAGE The system event message type is used to signal a market or data feed handler event. The format is as follows: SYSTEM EVENT MESSAGE NAME OFFSET LENGTH VALUE NOTES Message Type 0 1 “S” S – System Event Message. Timestamp – Nanoseconds 1 4 Numeric Nanoseconds portion of the timestamp. Event Code 5 1 Alpha Values: O = Start of Messages. Outside of time stamp messages, the start of day message is the first message sent on any trading day. C = End of Messages. This is always the last message sent on any trading day. 2.3.4.1.1 SAMPLE MESSAGE S| 331235922|O 2.3.4.2 ORDER BOOK STATE MESSAGE The Order book state message relays information on state changes. NOTE: Securities that are traded with single price method are subject to a total of five session states in the trading day. There are 2 session states before lunch break, and the others are performed after lunch break. If the trading method is “single price” and there is no matching after the end of session state, the clients may receive the order book state message “M-PreOpenEnd (Matching)” with delay. ORDER BOOK STATE MESSAGE NAME OFFSET LENGTH VALUE NOTES Message Type 0 1 “O” O – Order Book State Message. Timestamp – Nanoseconds 1 4 Numeric Nanoseconds portion of the timestamp. © 2014 Borsa İstanbul A.Ş. 14 ORDER BOOK STATE MESSAGE NAME OFFSET LENGTH VALUE NOTES Order book ID 5 4 Numeric Order book identifier. State Name 9 20 Alpha Values: P = PreOpen Begin M = PreOpen End(Matching) O = Open S = Surcon(End state of session ) H = Halted 2.3.4.2.1 SAMPLE MESSAGE O|331235923|111694|P 2.3.4.2.2 TRADING SESSION STATUS MAPPING The following tables describe the daily “Order Book State Message” according to trading method of the individual instrument. Warrants, certificates and rights coupons is not subject of call phase, therefore there will be no P and M messages for these kind of instruments. TRADING METHOD: CONTINUOUS MATCHING TRADING DAY TRADING SESSION STATE DESCRIPTION ORDERBOOKSTATE (STATENAME) TIME 1 Call Phase / Order collection P (PreOpen Begin) 09:15 2 Price Determination Phase and M (PreOpen End/Matching) 09:30 FIRST SESSION Opening Session Opening Transactions. Main Trading 3 Continuous Auction O (Open) 09:35 4 End of Continuous Auction S (Surcon) 12:30 5 Call Phase / Order collection P (PreOpen Begin) 14:00 M (PreOpen 14:10 SECOND SESSION Opening Session (Opening Session) 6 Price Determination Phase and © 2014 Borsa İstanbul A.Ş. 15 TRADING DAY Main Trading Closing Session TRADING SESSION STATE DESCRIPTION ORDERBOOKSTATE (STATENAME) TIME Opening Transactions. End/Matching) 7 Continuous Auction (Main Trading) O (Open) 14:15 8 End of Continuous Auction S (Surcon) 17:30 9 Call Phase (order collection) P (PreOpen Begin) 17:33 10 Closing Price Determination Phase M (PreOpen End/Matching) 17:36 11 Trades at Closing Price/Single Price O (Open) 17:38 12 End of Trading at Closing Price/Single S (Surcon) 17:40 TRADING SESSION STATE DESCRIPTION ORDERBOOKSTATE (STATENAME) TIME 1 Call Phase / Order collection P (PreOpen Begin) 09:15 2 Price Determination Phase and M (PreOpen End/Matching) 09:30 Price TRADING METHOD: SINGLE PRICE TRADING HOURS FIRST SESSION Opening Session Opening Transactions. Single Price Auction 3 Call Phase (order collection) P (PreOpen Begin) 09:35 4 Price Determination Phase M (PreOpen End/Matching) 12:30 5 Call Phase / Order collection P (PreOpen Begin) 14:00 M (PreOpen End/Matching) 14:10 SECOND SESSION Opening Session (Opening Session) 6 Price Determination Phase and Opening Transactions. © 2014 Borsa İstanbul A.Ş. 16 TRADING HOURS Single Price Auction Closing Session TRADING SESSION STATE DESCRIPTION ORDERBOOKSTATE (STATENAME) TIME 7 Call Phase (order collection) P (PreOpen Begin) 14:15 8 Price Determination Phase M (PreOpen End/Matching) 17:30 9 Trades at Closing Price/Single Price O (Open) 17:38 10 End of Trading at Closing Price/Single S (Surcon) 17:40 Price NOTE: Closing session will be run on half trading days phases of which are given below: •Call Phase (Order Collection): (3 minutes, 12.33 – 12.36) •Price Determination Phase: (2 minutes, 12.36 – 12.38) •Trades at Closing Price/Single Price: (2 minutes, 12.38 – 12.40) 2.3.5 ORDER LEVEL DATA NOTE: Order IDs are always unique in Borsa İstanbul trading system 2.3.5.1 ADD ORDER MESSAGES An Add Order Message indicates that a new order has been accepted by Borsa İstanbul trading system and was added to the displayable book. The message includes an Order ID that is unique in Borsa İstanbul trading system. NOTE: If the incoming order was fully matched with the existing order in the book, add order message will not be generated. Add Order Message does not include participant identifier of an order. © 2014 Borsa İstanbul A.Ş. 17 ADD ORDER MESSAGE NAME OFFSET LENGTH VALUE NOTES Message Type 0 1 “A” A – Add Order Message. Timestamp – Nanoseconds 1 4 Numeric Nanoseconds portion of the timestamp. Order ID 5 8 Numeric The unique identifier assigned to the new order. Order book ID 13 4 Numeric Order book identifier. Side 17 1 Alpha The type of order being added. “B” = buy order. “S” = sell order. Order book Position 18 4 Numeric Rank within order book. Quantity 22 8 Numeric The quantity of the order. Price 30 4 Price The price of the new order. Quote Indicator 34 2 Numeric Possible values: Always start at 1. 1 = Normal (casual) order 2 = This order is a side of quote order. NOTE: The quote order is divided into buy and sell side orders in Borsa İstanbul trading system. This field can be used to distinguish normal and quote orders by clients while tracking the order books. Lot Type 36 1 Numeric Not used by Borsa İstanbul. 2.3.5.1.1 SAMPLE MESSAGE A|331235922|1309201300004145|3406|B|110|235|6960|1|0 2.3.5.2 MODIFY ORDER MESSAGES Modify Order messages always include the Order ID, Order book ID and Side of the original Order to which the update applies. There are three kinds of modify messages; Order Executed Message (E) Order Replace Message (U) Order Delete Message (D) © 2014 Borsa İstanbul A.Ş. 18 To determine the current display quantity for an order, ITCH subscribers must deduct the number of lots stated in the modify message (executed) from the original quantity stated in the Add Order message with the same Order ID. Borsa İstanbul trading system may send multiple Modify Order messages for the same order and the effects are cumulative. When the visible quantity for an order reaches “0”, the order should be removed from the order book. 2.3.5.2.1 ORDER EXECUTED MESSAGE This message is sent whenever an order on the book is executed in whole or in part. If the incoming order causing the match cannot be entirely fulfilled, the remainder will be placed in the book after the match has occurred. It is possible to receive several Order Executed Messages for the same order if that order is executed in several parts. Multiple Order Executed Messages on the same order are cumulative. ORDER EXECUTED MESSAGE NAME OFFSET LENGTH VALUE NOTES Message Type 0 1 “E” E – Order Executed Message. Timestamp – Nanoseconds 1 4 Numeric Nanoseconds portion of the timestamp. Order ID 5 8 Numeric The identifier assigned to the new order. Order book ID 13 4 Numeric Order book identifier. Side 17 1 Alpha The type of order being added. Values: “B” = buy order. “S” = sell order. Executed Quantity 18 8 Numeric The quantity being executed. Match ID 26 8 Numeric Assigned by the system to each match executed. Combo Group ID 34 4 Numeric Not used by Borsa İstanbul. Reserved 38 7 Alpha Not used by Borsa İstanbul. Reserved 45 7 Alpha Not used by Borsa İstanbul. 2.3.5.2.1.1 SAMPLE MESSAGE E|912519948|1309201300005775|1739854|B|100|652|0| © 2014 Borsa İstanbul A.Ş. 19 2.3.5.2.2 ORDER REPLACE MESSAGE This message is sent whenever an order on the book has been amended. The remaining quantity from the original order is no longer accessible, and must be removed. OrderID, Side and Order book ID remain the same as the original order. ORDER REPLACE MESSAGE NAME OFFSET LENGTH VALUE NOTES Message Type 0 1 “U” U – Order Replace Message. Timestamp – Nanoseconds 1 4 Numeric Nanoseconds portion of the timestamp. Order ID 5 8 Numeric The original order identifier of the order being replaced. NOTE: The Order ID does not change when the order is replaced. Order book ID 13 4 Numeric Order Book Identifier. Side 17 1 Alpha Values: “B” = buy order. “S” = sell order. New Order book Position 18 4 Numeric New Rank within order book. The order won’t loose (keep) its price/time priority in the following modification situations; Quantity decrease Time validity decrease (from day order to session order) When the modification has resulted in the order losing price/time priority, the new rank will be indicated in the “New Order Book Position”. Otherwise, the rank will be same with the above modification; “New Order Book Position” value will be set to zero (“0”). Quantity 22 8 Numeric The new quantity of the order. Price 30 4 Price The new price of the order. Order Attributes 34 2 Numeric Not used by Borsa İstanbul. 2.3.5.2.2.1 SAMPLE MESSAGE U|94630116|1309201300005881|B|0|236|4230|0 © 2014 Borsa İstanbul A.Ş. 20 2.3.5.2.3 ORDER DELETE MESSAGE This message is sent whenever an order on the book is deleted. There will be no balance, so the order should be removed from the book. Please note that normally, no Order Delete message is sent when an order is completely fulfilled except quote orders. The receiver needs to keep track of the balance on all orders by recalculating the remaining quantity on each Order Executed message received. Orders must be removed from the book when the balance reaches zero (“0”). However, in the quote orders (quote indicator field is equal to 2 in add order message), clients must keep orders with zero quantity in the book in accordance with Borsa İstanbul ranking rules. Borsa İstanbul always sends an Order Delete message for quote orders if necessary. NOTE: In normal (casual-standard) orders (Quote Indicator = 1 “AddOrder”) Order Delete messages are not sent when orders with undisclosed quantity are entirely fulfilled. In quote orders (Quote Indicator = 2 “AddOrder”) Order Delete messages will be sent, clients must wait for Order Delete message for ranking issues when orders with undisclosed quantity are entirely fulfilled. ORDER DELETE MESSAGE NAME OFFSET LENGTH VALUE NOTES Message Type 0 1 “D” D – Order Delete Message. Timestamp – Nanoseconds 1 4 Numeric Nanoseconds portion of the timestamp. Order ID 5 8 Numeric The ID of the order is deleted. Order book ID 13 4 Numeric The Order book ID. Side 17 1 Alpha Values: “B” = buy order. “S” = sell order. 2.3.5.2.3.1 SAMPLE MESSAGE D| 331235922| 1309201300004145|3406|B © 2014 Borsa İstanbul A.Ş. 21 2.3.6 TRADE MESSAGES 2.3.6.1 TRADE MESSAGE The Trade Message is designed to provide execution details for normal match events involving nondisplayable order types. Since no Add Order Message is generated when a non-displayed order is initially received, the Order Executed message cannot be used for all matches. The Trade Message is used to report a match for a non-displayable order in the book. It is possible to receive multiple Trade Messages for the same order if that order is executed in several parts. Trade Messages for the same order are cumulative. Trade Messages should be included in trade tickers as well as volume and other market statistics. TRADE MESSAGE NAME OFFSET LENGTH VALUE NOTES Message Type 0 1 “P” P – Trade Message Identifier Timestamp – Nanoseconds 1 4 Numeric Nanoseconds portion of the timestamp. Match ID 5 8 Numeric Assigned by the system to each match executed. Combo Group ID 13 4 Numeric Not used by Borsa İstanbul. Side 17 1 Alpha Values: “B” =buy order “S” =sell order Quantity 18 8 Numeric The quantity being matched in this execution. Order book ID 26 4 Numeric Order book ID Trade Price 30 4 Price Trade Price Reserved 34 7 Alpha Not used by Borsa İstanbul. Reserved 41 7 Alpha Not used by Borsa İstanbul. Printable 48 1 Alpha Indicates if the trade should be included in trade tickers and volume calculations. Values: “Y” = printable © 2014 Borsa İstanbul A.Ş. 22 TRADE MESSAGE NAME OFFSET LENGTH VALUE NOTES *”N” is not used by Borsa İstanbul. Occurred at Cross 49 1 Alpha Values: “Y” = Yes, trade occurred at the cross *”N” is not used by Borsa İstanbul. 2.3.6.1.1 SAMPLE MESSAGE P|774328242|166|B|2786|57422|5760| | |Y|Y 2.4 PROTOCOL FLOW TIME LINE DETAIL Beginning of the Trading Day The ITCH channel begins sending messages at 08:50 on every trading day. The “Second Message (T)” will be disseminated for every second for which, there is at least one message. “System Event Message (S)” with “Event Code=O” is the first message that will be sent on any trading day. The reference data for all securities (Equities, ETFs, Warrants, Coupons, Certificates - including halted) will be disseminated with “Order Book Directory (R) and “Tick Size Table Entry (L)“ for the following session. Intraday / During the Trading Sessions The ITCH channel starts to send “Order Book State (O)” message with “State Name = P” for all securities when the opening session starts. ITCH does not provide standalone information on the status of the market. During call phase (pre-open, order collection), order books are blind and there is no data disseminating. The ITCH channel starts to send “Order Book State (O)” message with “State Name = M” for all securities when the opening session ends. The “Trade (P)” Message is used to report a match for a non-displayable order in the book following the price determination phase. ! IMPORTANT NOTE: © 2014 Borsa İstanbul A.Ş. During call phase (dark pool, blind orders) clients will not receive any ITCH messages for book changes. After receiving “Order Book State (O)” message with “State Name = P (PreOpen Begin)” for a book, all outstanding orders in the book must be cleared by the client. “Order Delete (D)” messages will not be sent in this case; don’t expect them. “Trade (P)” messages will be sent. Finally, the client will get snapshot of the book with “Add Order 23 TIME LINE DETAIL (A)” messages starting with ranking #1. If there is no matching after the end of call phase, the clients will not receive the order book state message “M-PreOpenEnd (Matching)”. The ITCH channel starts to send “Order Book State (O)” message with “State Name = O” when the continuous auction starts. Each time an anonymous order is added to the order book of an instrument, an “Add Order (A)” message will be published with details of the side, price and displayed quantity stated in the “Side”, “Price” and “Quantity” fields respectively. When an order is deleted from the book, the “Order Deleted (D)” message will be published. If an order’s price or volume is modified, an “Order Replace (U)” message will be disseminated with the revised price and quantity. ! IMPORTANT NOTE: The order won’t loose (keep) its price/time priority in the following modification situations; Quantity decrease Time validity decrease (from day order to session order) When the modification has resulted in the order losing price/time priority, the new rank will be indicated in the “New Order Book Position”. Otherwise, the rank will be same with the above modification, “New Order Book Position” value will be set to zero (“0”). On-book executions at the displayed price of the order are published in the “Order Executed (E)” message. The quantity specified in the “Executed Quantity” field should be deducted from the original displayed quantity of the order. The “Order Executed (E)” message will not contain a price and this should be inferred from the original limit price of the order. All executions will have a unique “Match ID” value. As an instrument transitions through its various states (e.g. halted, open) during the trading day, an “Order Book State (O)” message is immediately published with the new state identified in the field “State Name”. The ITCH channel starts to send “Order Book State (O)” message with “State Name =S” when the continuous auction ends. “Order Book State (O)” message behavior is the same as the opening session for single price auction and closing session. In Between Two Trading Sessions Order Delete Message (D) is sent for the session orders that will be cancelled after the first session close. The updated reference data for all securities (Equities, ETFs, Warrants, Coupons, Certificates - including halted) will be disseminated with “Order Book Directory (R) and “Tick Size Table Entry (L)“ for the following © 2014 Borsa İstanbul A.Ş. 24 TIME LINE DETAIL session. There is no data disseminating except cancelled orders and reference data from 12:45 to 13:15 (Break time between two sessions may vary according to the internal operational procedures). End Of The Trading Day Order Delete Message (D) is sent for the session and day orders that will be cancelled at the end of the trading day. “System Event Message (S)” with “Event Code=C” is the last message that will be sent on any trading day. The ITCH channel stops sending messages for the day at 17:55. 2.5 HOW TO BUILD AN ORDER BOOK VIEW The information needed to build an order book view from the ITCH message flow is contained in the Add Order Messages and the Modify Order Messages. The messages are: • Add Order • Order Executed • Order Replace • Order Delete Orders shall be ranked by: • Order Book Position. 1 denotes the highest ranked order. For an Order Replace, the order must be removed from its previous position and inserted at New Order Book Position. An order inserted at an existing position shifts the order on that position down (and all orders below as well). A deleted or fully filled order causes existing orders below it to shift their position up one step to fill the “void”. • If the remaining quantity is “0” (zero), Order Delete message will not be sent for normal (standard-casual) orders. Track the remaining quantity and remove the order from the book if the quantity reaches “0” (zero). Otherwise, in quote orders, Order Delete message is sent by Borsa İstanbul. The Order Replace message signals that the order has been modified. The current rank may or may not be lost in the process Order Book Position will show the new rank within the book. The “Order Delete (D)” message tells the recipient to remove the order from the book. © 2014 Borsa İstanbul A.Ş. 25 NOTE: If the rank will be the same with the Order Replace message, then New Order Book Position (rank) value will be set to “0” (zero). NOTE: • • • During call phase (dark pool, blind orders) clients will not receive any ITCH messages for book changes. After receiving “Order Book State (O)” message with “State Name = P (PreOpen Begin)” for a book, all outstanding orders in the book must be cleared by the client*. “Order Delete (D)” messages will not be sent in this case; don’t expect them. “Trade (P)” messages will be sent. Finally, the client will get snapshot of the book with “Add Order (A)” messages** starting with ranking #1. * Outstanding orders in the client side book will be invalid after the call (order collection) phase. Therefore client must clear the book when Preopen (State Name = P) “Order Book State” message is received. * Pre-Open of the first and second session, closing session and call phase of single price securities during the continuous auction of the first and second sessions will have blind orders (dark pool). ** Nanosecond field of “Add Order (A)” messages will be always “0” (zero) for snapshot of blind orders (dark pool) because waiting orders written on the book after matching and original order receive times are not distributed. © 2014 Borsa İstanbul A.Ş. 26 2.6 SAMPLE SCENARIOS 2.6.1 CASE 1 New order entry, amend and delete STEP SCENARIO ITCH ATTRIBUTES ACTIVITY 1 Order Entered Into Book (A) A Order ID (A) qty and price (A). Store Order ID, Quantity and Price for (A) U Order ID (A) qty and price (A). Modify quantity and price for Order ID D Order ID (A) Remove Order ID (A) [ADD ORDER] (A) 2 Order Amended (A) [ORDER REPLACE] (A) 3 Order Deleted (A) [ORDER DELETE] (A) 2.6.2 CASE 2 New order fully trades with existing order(s) STEP SCENARIO ITCH ATTRIBUTES ACTIVITY 1 Order Entered Into Book (A) A Order ID (A) qty and price (A). Store Order ID, Quantity and Price for (A) E Execution qty order ID (A) price (A) Subtract executed quantity from stored Order ID (A) [ADD ORDER] (A) 2* New order (B) fully trades with (A) (and possibly other existing orders) [ORDER EXECUTED] (A) 2.6.3 *If stored Order ID (A) quantity is zero, delete the stored order CASE 3 New order partially trades with existing order(s) STEP SCENARIO ITCH ATTRIBUTES ACTIVITY 1 Order Entered Into Book (A) A Order ID (A) qty and price (A). Store Order ID, Quantity and Price for (A) E Execution qty order ID (A) price (A) Subtract executed quantity from stored Order ID (A) [ADD ORDER] (A) 2* New order (B) partially trades with (A) (and possibly other existing orders) [ORDER EXECUTED] (A) © 2014 Borsa İstanbul A.Ş. *If stored Order ID (A) quantity is zero, delete the stored order 27 STEP SCENARIO ITCH ATTRIBUTES ACTIVITY 3 Remaining quantity of Order Entered into book (B) A Remaining Order ID (B) qty and price (B) Store Order ID, Quantity and Price for (B) [ADD ORDER] (B) 2.6.4 CASE 4 Existing order is amended and fully trades with the existing order STEP SCENARIO ITCH ATTRIBUTES ACTIVITY 1 Order Entered Into Book (A) A Order ID (A) qty and price (A). Store Order ID, Quantity and Price for (A) A Order ID (B) qty and price (B). Store Order ID, Quantity and Price for (B) U Price (B) Modify price for Order ID E Execution qty order ID (A) Modify quantity for Order ID (A) D Order ID (B) Stored Order ID (B) quantity is zero [ADD ORDER] (A) 2 Order Entered Into Book (B) [ADD ORDER] (B) 3 Existing order amended(B) [ORDER REPLACE] (B) 4 Order(B) fully trades with existing order(A) [ORDER EXECUTED] (A) 5 Order (B) Amended to trade with (A) (and possibly other existing orders) Remove Order ID (B) [ORDER DELETE] (B) 2.6.5 CASE 5 Existing order is amended and partially trades with existing order STEP SCENARIO ITCH ATTRIBUTES ACTIVITY 1 Order Entered into Book (A) A Order ID (A) qty and price (A). Store Order ID, Quantity and Price for (A) A Order ID (B) qty and price (B). Store Order ID, Quantity and Price for (B) U Price (B) Modify price for Order ID E Execution qty order Stored Order ID (A) [ADD ORDER] (A) 2 Order Entered into Book (B) [ADD ORDER] (B) 3 Existing order amended(B) [ORDER REPLACE] (B) 4 Order(B) partially trades with © 2014 Borsa İstanbul A.Ş. 28 STEP SCENARIO ITCH existing order(A) and Order(A) is ATTRIBUTES ACTIVITY ID (A) quantity is zero, delete the stored order! Remaining quantity (B) Store Order ID (B) with new quantity fully filled. [ORDER EXECUTED] (A) 5 Modify quantity for Order ID(B) U [ORDER REPLACE] (B) 3. GLIMPSE GLIMPSE is a recovery channel which should be used by ITCH direct data feed subscribers to recover from a late join or large-scale data loss. Using the GLIMPSE facility, ITCH data feed subscribers may obtain a snapshot of the order books at any point during the trading day. Clients may use the GLIMPSE channel to validate order book displays or to recover from major data gaps during the trading day. 3.1 ARCHITECTURE GLIMPSE channel includes a series of logical packets that are used for client-server communication and delivery of a set of sequenced messages from a server to a client. LOGICAL PACKETS Categories Code Message Sent by Server A Login Accepted Packet J Login Rejected Packet S Sequenced Data Packet Z End Of Session Packet L Login Request Packet Sent by Client 3.1.1 LOGICAL PACKETS SENT BY SERVER All packets in GLIMPSE channel have got variable length and can be maximum 1024 bytes. 3.1.1.1 LOGIN ACCEPTED PACKET GLIMPSE server sends a “Login Accepted Packet” in response to receiving a valid “Login Request” from the client. This packet will always be the first packet sent by the server after a successful login request. © 2014 Borsa İstanbul A.Ş. 29 LOGIN ACCEPTED PACKET NAME OFFSET LENGTH VALUE NOTES Packet Length 0 2 Numeric Number of bytes after this field until the next packet Packet Type 2 1 “A” Login Accepted Packet Session 3 10 Alpha The session ID of the session that is now logged into. Left padded with spaces. Sequence Number 13 8 Numeric NOTE1: The sequence number of the last sent Sequenced Message in the Rewinder channel. NOTE2: This value is always 0(zero) in the Glimpse channel. Max Number Of Message In Memory 21 8 Numeric NOTE1: The maximum number of the latest messages from the cache in the Rewinder channel. NOTE2: This value is always 0(zero) in the Glimpse channel. Max Number Of Message Per Request 29 4 Numeric NOTE1: The maximum number of messages per request in the Rewinder channel. NOTE2: This value is always 0(zero) in the Glimpse channel. 3.1.1.2 LOGIN REJECTED PACKET GLIMPSE server sends this packet in response to an invalid “Login Request” from the client. The server closes the socket connection after sending the Login Reject Packet. The Login Rejected Packet will be the only packet sent by the server in the case of an unsuccessful login attempt. LOGIN REJECTED PACKET NAME OFFSET LENGTH VALUE NOTES Packet Length 0 2 Numeric Number of bytes after this field until the next packet Packet Type 2 1 “J” Login Rejected Packet Reject Reason Code 3 1 Alpha Valid values: A = Not Authorized. There was an invalid username and password combination in the Login Request Message. S = Session not available. The Requested Session in the Login Request Packet was © 2014 Borsa İstanbul A.Ş. 30 LOGIN REJECTED PACKET NAME OFFSET LENGTH VALUE NOTES either invalid or not available. 3.1.1.3 SEQUENCED DATA PACKET The Sequenced Data Packets act as an envelope to carry the actual sequenced data messages that are transferred from the server to the client. Each Sequenced Data Packet carries one message. The sequence number of each message is implied; the initial sequence number of the first Sequenced Data Packet for a given TCP/IP connection is specified in the Login Accepted Packet and the sequence number increments by 1 for each Sequenced Data Packet transmitted. Since logical packets are carried via TCP/IP sockets, the only way logical packets can be lost is in the event of a TCP/IP socket connection failure. SEQUENCED DATA PACKET NAME OFFSET LENGTH VALUE NOTES Packet Length 0 2 Integer Number of bytes after this field until the next packet Packet Type 2 1 “S” Sequenced Data Packed Message 3 * 3.1.1.4 END OF SESSION PACKET The server will send an End of Session Packet to denote that the current session is finished. The connection will be closed shortly after this packet, and the user will no longer be able to reconnect to the current session. END OF SESSION PACKET NAME OFFSET LENGTH VALUE NOTES Packet Length 0 2 Numeric Number of bytes after this field until the next packet Packet Type 2 1 “Z” End of Session Packet 3.1.2 LOGICAL PACKETS SENT BY CLIENT 3.1.2.1 LOGIN REQUEST PACKET Client must send a Login Request Packet immediately upon establishing a new TCP/IP socket connection to the server. Client and server must have mutually agreed upon the username and © 2014 Borsa İstanbul A.Ş. 31 password fields. Both Username and Password are case-sensitive and should be padded on the right with spaces. The server can terminate an incoming TCP/IP socket if it does not receive a Login Request Packet within a reasonable period of time (typically 30 seconds). LOGIN REQUEST PACKET NAME OFFSET LENGTH VALUE NOTES Packet Length 0 2 Numeric Number of bytes after this field until the next packet Packet Type 2 1 “L” Login Request Packet Username 3 6 Alpha Username Password 9 10 Alpha Password Requested Session 19 10 Alpha Always must be blank to log into the currently active session. Requested Sequence Number 29 20 Alpha Always must be “1”. Exception: Right justified and padded with spaces on the left. 3.2 DATA TYPES GLIMPSE messages have the same data types as ITCH messages. 3.3 MESSAGE FORMATS GLIMPSE uses a subset of ITCH messages and also contains below “End of Snapshot Message”. 3.3.1 END OF SNAPSHOT MESSAGE The end of snapshot message is sent at the end of a GLIMPSE snapshot and returns the current ITCH sequence number to be used when connecting to the ITCH feed. To maintain a real-time order display, real-time processing of ITCH messages should begin with the sequence number stated in this snapshot message. END OF SNAPSHOT MESSAGE NAME OFFSET LENGTH VALUE NOTES Message Type 0 “G” End of Snapshot Message. © 2014 Borsa İstanbul A.Ş. 1 32 END OF SNAPSHOT MESSAGE NAME OFFSET LENGTH VALUE NOTES Sequence Number 1 Alpha Last proceeded ITCH sequence number at the time the snapshot was taken. 20 To be used when applying messages received via the ITCH feed. 3.4 PROTOCOL FLOW GLIMPSE can be used to quickly sync up with the ITCH feed. Client must connect to real-time ITCH feed before the GLIMPSE connection. Client connection begins with the client opening a TCP/IP socket to the server and sending a “Login Request Packet”. If the login request is valid, the server responds with a “Login Accepted Packet”. The connection continues until the TCP/IP socket is broken. Otherwise, “The Login Rejected Packet” will be sent by the server in the case of an unsuccessful login attempt. The server will not send heartbeats on the GLIMPSE channel during periods of inactivity. If a “Login Request Packet” is not received within 30 seconds of the establishment of a TCP/IP connection, the server will break the TCP/IP connection with the client. The sequence number of the first sequenced message in each session is always 1. After a successful login attempt, GLIMPSE utilizes all snapshot messages with “Sequenced Data Packet” used by ITCH to describe the current state of the book, with the exception of those messages that change the state of the order book (e.g. Delete, Execute and Trade). Clients do not need to submit any request on the GLIMPSE channel to get outstanding snapshot. After a successful login attempt, GLIMPSE will be processed automatically. Glimpse provides the following: Basic Reference Data for each order book including intra-day updates Current trading state of each order book All outstanding orders for each order book. At the end of the Glimpse snapshot, a sequence number is provided with “End of Snapshot Message” that can be used to connect and sync up with the real-time ITCH feed. GLIMPSE will send an “End of Session Packet” to denote that the current session is finished. Lastly, the server will break the TCP/IP connection with the client and terminate the connection. © 2014 Borsa İstanbul A.Ş. 33 NOTE: If there is a gap between ITCH sequence number and GLIMPSE sequence number, the client should use REWINDER and request the retransmission of missing messages. NOTE: In such a scenario, when the transmission is broken (e.g. connection break) before the outstanding snapshot is complete, clients must discard the affected order book. Then clients should re-connect to the GLIMPSE channel and follow the protocol from the first step. 4. REWINDER REWINDER is the point-to-point TCP replay channel that should be used by the recipients to recover from a small-scale data loss in the event of a gap in sequence numbers. It permits clients to request the retransmission of a limited number of messages already published on ITCH. The channel supports the retransmission of the last 100,000 messages published. Retransmission of every single request can cover maximum 5,000 messages that have been already published. Clients should login to the REWINDER channel up to a limited number of times each day. This feature is intended to help manage an emergency situation and should not be relied upon as a normal practice. 4.1 ARCHITECTURE REWINDER channel uses a subset of logical packets which are defined in the “GLIMPSE Architecture”. These logical packets are used for client-server communication. The logical packets below are used for only REWINDER channel. LOGICAL PACKETS Categories Code Message Sent by Server A Login Accepted Packet J Login Rejected Packet V Request Accept Packet Y Request Reject Packet Z End Of Session Packet © 2014 Borsa İstanbul A.Ş. 34 LOGICAL PACKETS Categories Code Message Sent by Client L Login Request Packet X Request Message 4.1.1 LOGICAL PACKETS SENT BY SERVER All packets in REWINDER channel have got variable length and can be maximum 1024 bytes. 4.1.1.1 REQUEST ACCEPT PACKET The server will respond to the “Request Packet” with a “Request Accept Packet” to indicate that the retransmission request is successful. In the case of a successful request, the server will retransmit the requested messages immediately after the “Request Accept Packet”. The sequence numbers of the retransmitted messages will be the same as when they were first disseminated on the ITCH channel. REQUEST ACCEPT NAME OFFSET LENGTH VALUE NOTES Packet Length 0 2 Numeric Number of bytes after this field until the next packet Packet Type 2 1 “V” Request Accepted Packet 4.1.1.2 REQUEST REJECT PACKET The server will respond to the “Request Packet” with a “Request Reject Packet” to indicate that the retransmission request is not successful. REQUEST REJECT PACKET NAME OFFSET LENGTH VALUE NOTES Packet Length 0 2 Numeric Number of bytes after this field until the next packet Packet Type 2 1 “Y” Request Reject Packet Reject Reason Code 3 3 Alpha Valid Values: 400 = Beqin sequence number is less than “1” (one). 402 = End sequence number is less than “0” (zero). © 2014 Borsa İstanbul A.Ş. 35 REQUEST REJECT PACKET NAME OFFSET LENGTH VALUE NOTES 404 = Beqin sequence number is greater than the end sequence number. 406 = Messages are not ready. 408 = Message interval is too big. 410 = Messages are not in the recovery storage. 412 = Messages are not ready for recovery, try again. 498 = Unknown request type. Sequence Number 6 8 Numeric This field is only available if the reject reason code is 410 or 412. Otherwise the Request Reject Packet does not contain the sequence Number field. If the Reject Reason Code equal to 410; this field represent the lowest sequence number of the messages that are in the recovery storage. If the Reject Reason Code equal to 412; this field represent the highest sequence number of the messages that are in the recovery storage. 4.1.2 LOGICAL PACKETS SENT BY CLIENT 4.1.2.1 REQUEST PACKET Clients can use the “Request Packet” to request the retransmission of missed messages. The request should include begin and/or end sequence number(s) of the range to be retransmitted along with the number of messages to be retransmitted. The maximum range of sequence numbers can be 5000. To request a single message: Begin Sequence Number = End Sequence Number To request a range of messages: Begin Sequence Number = first message of range, End Sequence Number = last message of range To request all messages subsequent to a particular message: Begin Sequence Number = first message of range, End Sequence Number = 0 (represents infinity – to the latest number). © 2014 Borsa İstanbul A.Ş. 36 The retransmission request will be serviced from the cache of the last 100,000 messages published on the ITCH channel. If the retransmission request includes one or more messages that are not in the cache, the entire request will be rejected but no message will be retransmitted. If “Request Packet” is not received within 30 seconds of a successful logon, the server will break the TCP/IP connection with the client. NAME OFFSET LENGTH VALUE NOTES Packet Length 0 2 Numeric Number of bytes after this field until the next packet Packet Type 2 1 “X” Request Packet Begin Sequence Number 3 8 Numeric The sequence number of the Begin Sequenced Message to be sent (big-endian) End Sequence Number 11 8 Numeric The sequence number of the End Sequenced Message to be sent (big-endian) 4.2 DATA TYPES REWINDER messages have the same data types as ITCH messages. 4.3 MESSAGE FORMATS REWINDER uses a subset of ITCH messages 4.4 PROTOCOL FLOW Client connection begins with the client opening a TCP/IP socket to the server and sending a “Login Request Packet”. If the login request is valid, the server responds with a “Login Accepted Packet”. The connection continues until the TCP/IP socket is broken. Otherwise, “The Login Rejected Packet” will be sent by the server in the case of an unsuccessful login attempt. The server will not send heartbeats on the REWINDER channel during periods of inactivity. If a “Login Request Packet” is not received within 30 seconds of the establishment of a TCP/IP connection, the server will break the TCP/IP connection with the client. After a successful login attempt, the client can send “Request Packet” to request the retransmission of missed messages. © 2014 Borsa İstanbul A.Ş. 37 If a “Request Packet” is not received within 30 seconds of a successful logon, the server will break the TCP/IP connection with the client. The server will respond to the “Request Packet” with a “Request Accept Packet” to indicate the retransmission request is successful. If request is unsuccessful, then “Request Reject Packet” will be sent by the server. In the case of a successful request, the server will retransmit the requested messages immediately after the “Request Accept Packet”. The sequence numbers of the retransmitted messages will be the same as when they were first disseminated on the ITCH. REWINDER will send an “End of Session Packet” to denote that the retransmission is finished. Lastly, the server will break the TCP/IP connection with the client and terminate the connection. © 2014 Borsa İstanbul A.Ş. 38