Itch Protocol
-
Upload
shantanusharma22 -
Category
Documents
-
view
112 -
download
1
Transcript of Itch Protocol
Hotspot ECN ITCH Protocol v1.20 (Major changes since v1.12 are highlighted in red)
1 Itch Session Management Protocol The Session Management Protocol provides login / logout and authentication facilities, as well as sequenced packet functionality which provides order information from the Hotspot ECN book. Clients receive missing data (e.g. after a disconnect/reconnect) via a market data snapshot payload in the Sequenced Data Packet message.
1.1 Data Types
Name Description
Integer ASCII coded integer. Integer fields are right justified and left padded with spaces.
Long ASCII coded long integer. Long fields are right justified and left padded with spaces.
Character 1 ASCII coded character. Must not be LF (0x0A) or ETX (0x03).
String Multiple ASCII coded characters. Must not contain LF (0x0A) or ETX (0x03).
1.2 Server to Client Messages
1.2.1 Login Accepted Packet
Field Name Offset Size Type
Message Type 0 1 ASCII ‘A’ (0x41)
Sequence Number 1 10 Integer
TLF 11 1 ASCII LF (0x0A)
1.2.2 Login Rejected Packet
Field Name Offset Size Type
Message Type 0 1 ASCII ‘J’ (0x4A)
Reason 1 20 String
TLF 21 1 ASCII LF (0x0A)
1.2.3 Sequenced Data Packet
Field Name Offset Size Type
Message Type 0 1 ASCII ‘S’ (0x53)
Time 1 9 String (HHMMSSmmm)
Payload 10 variable String
TLF variable 1 ASCII LF (0x0A)
1.2.4 Server Heartbeat Packet Sent to the connected client once every second only if there were no other messages to send in the prior second. Field Name Offset Size Type
Message Type 0 1 ASCII ‘H’ (0x48)
TLF 1 1 ASCII LF (0x0A)
1.2.5 End of Session A session is closed with a zero-length sequenced data packet (0x53 0x0A). No more sequenced data packets may be sent after the session is closed. A client that receives such a packet may disconnect knowing that there are no more messages in that particular session.
1.2.6 Error Notification Packet Indicates an error condition in response to an invalid request from the connected client.
Field Name Offset Size Type
Message Type 0 1 ASCII ‘E’ (0x4A)
Error explanation 1 100 String
TLF 101 1 ASCII LF (0x0A)
1.2.7 Instrument Directory Message Lists currency pairs supported by the server. Requested by sending an Instrument Directory Request Packet (1.3.9)
1.3 Client to Server Messages
1.3.1 Login Request Packet Login Name and Password fields are left justified and right-padded with spaces. The Reserved field is right justified and left-padded with spaces. The Reserved field must be set to 0. When the Market Data Unsubscribe field is set to True (‘T’), upon logging in the client will not be subscribed to market data for any currency pairs. The client then needs to subscribe to either specific currency pairs or to the entire market by sending one or more of the Market Data Subscribe
Field Name Offset Size Type Comment
Message Type 0 1 ASCII ‘R’ (0x52)
Number of Currency Pairs 1 4 Integer
Currency Pair 5 7 String This field is repeated the number of times indicated by the preceding field.
TLF variable 1 ASCII LF (0x0A)
Request Packet (1.3.7). The default behavior with an uninitialized Market Data Unsubscribe field is to subscribe to all currency pairs.
Field Name Offset Size Type
Message Type 0 1 ASCII ‘L’ (0x4C)
Login Name 1 40 String
Password 41 40 String
Market Data Unsubscribe 81 1 Character ASCII ‘T’ (0x54) or ASCII ‘F’ (0x46)
Reserved 82 9 Integer
TLF 91 1 ASCII LF (0x0A)
1.3.2 Logout Request Packet
Field Name Offset Size Type
Message Type 0 1 ASCII ‘O’ (0x4F)
TLF 1 1 ASCII LF (0x0A)
1.3.3 Client Heartbeat Packet This message should be sent once every second. If the server does not receive a heartbeat or any other message in 15 seconds, the client is disconnected by the server.
Field Name Offset Size Type
Message Type 0 1 ASCII ‘R’ (0x52)
TLF 1 1 ASCII LF (0x0A)
1.3.4 Market Snapshot Request Packet This message is sent to the server in order to request the missing market data in the form of a Market Snapshot Message (2.2.4) either for a specific currency pair, or for all currency pairs relevant to the user. Currency Pair field is left justified and right-padded with spaces. If a request is made for all currency pairs at once, the Currency Pair field should be set to “ALL” without quotes. The Market Snapshot in response to this packet will not contain currency pairs which the client is not subscribed to.
Field Name Offset Size Type
Message Type 0 1 ASCII ‘M’ (0x53)
Currency Pair 1 7 String
TLF 8 1 ASCII LF (0x0A)
1.3.5 Ticker Subscribe Request Packet This message is sent to the server in order to turn on ticker data for either a specific currency pair, or for all currency pairs at once. To subscibe to all currency pairs, the Currency Pair field should be set to “ALL” without quotes. To subscribe only to certain currency pairs, multiple request packets should be sent, one for each desired currency pair. Ticker subscriptions are not maintained across sessions. Ticker data is off by default and must be explicitly subscribed to.
Field Name Offset Size Type
Message Type 0 1 ASCII ‘T’ (0x53)
Currency Pair 1 7 String
TLF 8 1 ASCII LF (0x0A)
1.3.6 Ticker Unsubscribe Request Packet This message is sent to the server in order to turn off previously enabled ticker data for either a specific currency pair, or for all currency pairs at once. To unsubscibe from all currency pairs, the Currency Pair field should be set to “ALL” without quotes. To unsubscribe only from certain currency pairs, multiple request packets should be sent, one for each desired currency pair. Ticker subscriptions are not maintained across sessions. Ticker data is off by default and must be explicitly subscribed to.
Field Name Offset Size Type
Message Type 0 1 ASCII ‘U’ (0x53)
Currency Pair 1 7 String
TLF 8 1 ASCII LF (0x0A)
1.3.7 Market Data Subscribe Request Packet Turns ON subscription to the entire market or to a specific currency pair. For subscription to the entire market, the Currency Pair field must be set to “ALL” without quotes. For subscription to specific currency pairs, multiple requests packets must be sent, one for each currency pair. Market data subscriptions are not maintained across sessions. By default, the client is subscribed to all currency pairs unless logging in with the Market Data Unsubscribe field in the Login Request Packet set to true.
Field Name Offset Size Type
Message Type 0 1 ASCII ‘A’ (0x41)
Currency Pair 1 7 String
TLF 8 1 ASCII LF (0x0A)
1.3.8 Market Data Unsubscribe Request Packet Turns OFF subscription to the entire market or to a specific currency pair. To disable subscription to the entire market, the Currency Pair field must be set to “ALL” without quotes. To disable subscription for specific currency pairs, multiple requests packets must be sent, one for each currency pair. Market data subscriptions are not maintained across sessions. By default, the client is subscribed to all currency pairs unless logging in with the Market Data Unsubscribe field in the Login Request Packet set to true.
Field Name Offset Size Type
Message Type 0 1 ASCII ‘B’ (0x42)
Currency Pair 1 7 String
TLF 8 1 ASCII LF (0x0A)
1.3.9 Instrument Directory Request Packet Requests a list of supported instruments from the server in the form of an Instrument Directory message (1.2.7)
Field Name Offset Size Type
Message Type 0 1 ASCII ‘I’ (0x49)
TLF 8 1 ASCII LF (0x0A)
2 HotspotFX Book Protocol
Book Protocol messages carry information about the HotspotFX ECN book. To receive the HotspotFX ECN book feed, the client connects to the HotspotFX ECN Book Server using the ITCH Session Management protocol. Each Book Protocol message will be carried inside the payload field of a Session Management Protocol sequenced data packet, which is described in section 1.2.3.
2.1 Data Types
Name Description
Integer ASCII coded integer. Integer fields are right justified and left-padded with spaces.
Character 1 ASCII coded character.
String Multiple ASCII coded characters.
Double Decimalized number.
2.2 Messages
2.2.1 New Order Message
Field Name Offset Size Type
Message Type 0 1 ASCII ‘N’ (0x4E)
Buy or Sell Indicator 1 1 Character Buy is ASCII ‘B’ (0x42) Sell is ASCII ‘S’ (0x53)
Currency Pair 2 7 String Order ID 9 15 String Price 24 10 String Amount 34 16 Double
Price is presented as a decimal number in ASCII format, i.e. 123.456 Order ID is a decimal number, unique per currency pair.
2.2.2 Modify Order Message
Field Name Offset Size Type
Message Type 0 1 ASCII ‘M’ (0x4D)
Currency Pair 1 7 String
Order ID 8 15 String
Amount 23 16 Double
2.2.3 Cancel Order Message
Field Name Offset Size Type
Message Type 0 1 ASCII ‘X’ (0x58)
Currency Pair 1 7 String
Order ID 8 15 String
2.2.4 Market Snapshot Message
Field Name Offset Size Type Comment
Message Type 0 1 ASCII ‘S’ (0x53)
Length of Message 1 6 Integer Length of market snapshot in bytes, starting with Number of Currency Pairs and incorporating all subsequent fields.
Number of Currency Pairs 7 4 Integer
Currency Pair 11 7 String This and all following fields are repeated the number of times indicated by the preceding field.
Number of bid prices variable 4 Integer
Bid Price variable 10 String This and all fields up to Number of Offer Prices is repeated the number of times indicated by the preceding field.
Number of Bid Orders variable 4 Integer
Amount variable 16 Double
Order ID variable 15 String
These two fields are repeated the number of times indicated by the preceding field.
Number of Offer Prices variable 4 Integer
Offer Price variable 10 String This and all following fields are repeated the number of times indicated by the preceding field.
Number of Offer Orders variable 4 Integer
Amount variable 16 Double
Order ID variable 15 String
These two fields are repeated the number of times indicated by the preceding field.
2.2.5 Ticker Message Field Name Offset Size Type
Message Type 0 1 ASCII ‘T’ (0x54)
Aggressor Buy or Sell Indicator 1 1 Character Buy is ASCII ‘B’ (0x42) Sell is ASCII ‘S’ (0x53)
Currency Pair 2 7 String
Price 9 10 String Transaction Date 19 8 String
(YYYYMMDD) Transaction Time 27 6 String (HHMMSS)
3 Revision History
1.00 (2007-10-08) Initial Revision 1.01 (2007-12-05) Reversed order of ‘Amount’ and ‘Order ID’ in Market Snapshot Message for Bid Orders. 1.02 (2007-12-07) Changed bid/offer character in New Order Message. 1.10 (2007-12-12) Added Ticker Subscribe Packet, Ticker Unsubscribe Packet, Error Notification Packet, and Ticker Message. 1.11 (2007-12-17) Changed time format in Sequenced Data Packet. 1.12 (2008-01-03) Changed order of fields in New Order Message. Added ‘Length of Message’ field to Market Snapshot Message Changed field sizes in Market Snapshot Message 1.20 (2008-04-04) Changed Login Request Packet Added Instrument Directory Request Packet, Instrument Directory Message, Market Data Subscribe Request Packet, and Market Data Unsubscribe Request Packet