Back to top

itBit Streaming Market Data

Introduction

Overview

The information in this document describes the adaptation of the standard FIX 4.2 for vendors and subscribers to communicate with the itBit FIX Market Data Gateway. itBit also supports websockets for market data subscription

Hours of Operation

The FIX Market Data service is restarted daily at 23:59 UTC to allow sequence numbers to reset.
itBit recommends that FIX Market Data customers plan to disconnect daily at 23:59 UTC and reconnect at 00:01 UTC, expecting new inbound sequence numbers from itBit. Customers should expect to be disconnected from the service at 23:59 UTC while it restarts.

Precision

ETH and XBT markets are currently traded with 8 decimal places of precision while fiat currencies are traded with two decimal places of precision.

All timestamps are UTC as per FIX standard.

Connecting

Only one connection should be made to each account.

Markets

itBit currently supports trading in the following markets:

XBTUSD XBTEUR XBTSGD ETHUSD ETHEUR ETHSGD

Websockets - Market Data

Websockets

Connect via marketdata.staging-fix.itbit.com:{PORT}/websocket for staging, or marketdata.fix-tls.itbit.com:{PORT}/websocket for prod.

Please re-use your existing staging cert for Market Data. Websocket communication is over SSL so you should be able to use the same stunnel config.

Once connected you can subscribe to feed by sending the below message:

1. To subscribe to all books
 
 
 {
     "request":[
         {
         "msg":"ibook",
         "security":"*"
         }
     ],
     "type":"subscribe"
 }
 
 2. Subscribe to a particular book
 
 {
     "request":[
         {
         "msg":"ibook",
         "security":"XBTUSD"
         }
     ],
     "type":"subscribe"
 }
 
 
 3. Subscribe to trade updates for all markets
 
 
 {
     "request":[
         {
         "msg":"itrade",
         "security":"*"
         }
     ],
     "type":"subscribe"
 }
 
 4. Subscribe to trade updates for a particular market
 
 {
     "request":[
         {
         "msg":"itrade",
         "security":"ETHUSD"
         }
     ],
     "type":"subscribe"
 }

FIX API - Market Data

Message Header

Tag Field Name Req’d Comments
8 BeginString Y “FIX.4.2”
9 BodyLength Y (Always unencrypted, must be second field in message)
35 MsgType Y (Always unencrypted, must be third field in message)
49 SenderCompID Y Must be specified in all FIX messages, will be echoed back in TargetCompID in all FIX messages to customers.
56 TargetCompID Y Provided by customer, always echoed back in SenderCompID in all FIX messages to customers.
34 MsgSeqNum Y (Can be embedded within encrypted data section.)
52 SendingTime Y Required

Message Trailer

Tag Field Name Req’d Comments
10 CheckSum Y (Always unencrypted, always last field in message)

Heartbeat (MsgType = 0)

This message is intended to monitor the status of the communications link during periods of inactivity.

The FIX market data accepts and generates Heartbeat messages as per the FIX specification.

  • Inbound: Handled as specified

  • Outbound: In response to a test request or timeout.

  • Response: None

The heartbeat message should be sent if agreed upon Heartbeatinterval has elapsed since the last message sent.

Tag Field Name Req’d Comments
Standard Header Y MsgType = 0
112 TestReqID N Required when the heartbeat is the result of a Test Request message.
Standard Trailer Y

Logon (MsgType = A)

The logon message identifies and authenticates the user and establishes a connection to the FIX Gateway. After a successful logon as described in the specification the FIX gateway will initiate a Logon using the SenderCompID in the message header and begin regular message communication.

itBit to customer sequence numbers are only reset when the market data session is restarted (see hours of operation above for timing). They cannot be reset by the customer.

Customer to itbit sequence numbers can be reset by the customer upon establishing a new connection. If you are going to re-set your sequence numbers, please log out and log back in with the lower sequence number. No tag 141 is required to re-set your sequence numbers to 1. As long as the outbound sequence number from the customer to ItBit is lower (or equal to 1) than the previous session, itBit will not send a resend request.

Tag Field Name Req’d Comments
Standard Header Y MsgType = A
108 HeartBtInt Y Heartbeat interval in seconds
Standard Trailer Y

Example FIX Message

8=FIX.4.2|9=69|35=A|49=USERID|56=USERID1|34=1| 52=20190205-18:11:35|108=30|10=018|

Example FIX Message Response

8=FIX.4.2|9=69|35=A|49=USERID|56=USERID1|34=1| 52=20190205-18:11:39.261|98=0|108=30|10=021|

Test Request (MsgType = 1)

If a Heartbeatinterval + 1 second have elapsed since the last message received, a Test Request should be issued. If another Heartbeatinterval + 1 second go by without receiving a message, the TCP connection should be dropped.

Tag Field Name Req’d Comments
Standard Header Y MsgType = 1
112 TestReqID Y
Standard Trailer Y

Resend Request (MsgType = 2) - Unsupported

At this time market data is not stored on a per-connection basis and as such resend requests are not supported from customers to itBit. However, the itBit FIX Market Data Gateway will send consumers a Resend Request if it senses that sequence numbers are out of sync. Please log-out, reset your outbound sequence numbers and log-in again with a 141=Y and 36 = 1 to sync your sequence numbers with the Market Data Gateway.

Reject (Msg Type = 3)

This message is used by the itBit FIX Gateway to reject messages that violate session level rules and are unable to be processed. The gateway checks inbound messages for the presence of its required tags. It also validates the message type tag session level rejects are used to indicate violations of the session protocol, or missing fields.

Tag Field Name Comments
Standard Header MsgType = 3
45 RefSeqNum MsgSeqNum of rejected message
58 Text Where possible, message to explain reason for rejection
Standard Trailer

Sequence Reset (MsgType = 4)

itBit does not support requesting reset of outbound sequence numbers from itBit to customers. Outbound sequence numbers from itBit to customers are reset daily after the FIX engine restart at 23:57 UTC. Customers can reset their own outbond sequence numbers to itBit upon Logon by adding tags 141=Y and 36=1 in Msg Type = A.

Logout (MsgType = 5)

Upon receipt of a logout message from customers, the customer’s session will be terminated by the itBit FIX Market Data Gateway.

Application Messages – Customer to itBit

Market Data Request (MsgType = V)

Market Data Request messages are not required. Upon Logon, the itBit FIX Market Data Gateway will provide the full order book of all active markets. MsgType = V is not supported

Application Messages – itBit to Customer

Order of messages

Upon logon, the following messages get sent from itBit to customer automatically

  1. Top of the book W message

  2. Messages for individual orders - ‘X’ messages

  3. End of book - ‘X’ message

After these messages are sent, any changes to the order book will be sent to the user

  1. Top of the book changes send new ‘W’ messages

  2. Additional, Filled, Partially Filled or Cancelled orders will send updated ‘X’ messages

  3. Upon updates, there is no End Of Book ‘X’ message, because market data is streaming.

Top of Book Snapshot (MsgType = W)

The “W” message provides the best bid and ask in each market as well as an update for each trade that occurs on the itBit trading platform.

Each time the best bid and ask change on the gateway a new “W” message will be sent from itBit to the customer.

Tag Field Name Comments
Standard Header MsgType = W
55 Symbol Identifier for the symbol
268 NoMDEntries Value will be “2” given that this is just the best bid and offer.
269 MDEntryType Type of market data entry. Valid values: 0 = Bid1 = Offer
270 MDEntryPx Price of the market data entry.
271 MDEntrySize Quantity
262 MDReqID Value will be “0”
Standard Trailer

Example FIX Message

8=FIX.4.2|9=136|35=W|49=USERID|56=USERID1|34=75| 52=20190131-23:52:41.361|55=ETHUSD|268=2|269=0|270=106.33|271=4.2211| 269=1|270=106.37|271=8.1923|262=0|10=047|

Trade Data (MsgType = W)

Each time a trade occurs on the itBit trading platform, a “W” message is sent with the following format.

Tag Field Name Comments
Standard Header MsgType = W
55 Symbol Identifier for the symbol
268 NoMDEntries Value will be 1 given that only 1 trade at a time is sent via “W” message.
269 MDEntryType 2 = Trade
270 MDEntryPx Price of the market data entry.
271 MDEntrySize Quantity
262 MDReqID Value will be “0”
Standard Trailer

Example FIX Message

8=FIX.4.2|9=100|35=W|49=USERID|56=USERID1|34=11| 52=20190201-00:03:48.117|55=ETHUSD|268=1|269=2|270=106|271=1|262=0| 10=106|

Market Data – Order Book (MsgType = X)

“X” Messages provide all order data, inclusive of the full book upon login and the incremental refresh thereafter. An “X” End of Book message is used to denote separation between the two.

Order data messages have the following format.

Tag Field Name Comments
Standard Header MsgType = X
268 NoMDEntries Number of market data entries in this snapshot.
279 MDUpdateAction The Market Data update action type. It must be the first field in the repeating group. The only valid values are 0 = New1 = Change2 = Delete
269 MDEntryType Type of market data entry. Valid values: 0 = Bid 1 = Offer
278 MDEntryID Market data identifier
55 Symbol Identifier for the symbol
270 MDEntryPx Price of the market data entry
271 MDEntrySize Number of shares represented by the Market Data Entry
262 MDReqID The MDReqID of the MarketDataRequest message.
58 Text A unique ID from the OMS.
Standard Trailer

Example FIX Message

8=FIX.4.2|9=147|35=X|49=USERID|56=USERID1|34=32| 52=20190201-00:12:23.201|262=0|268=1|279=2|269=0| 278=247697979505377314|55=ETHUSD|270=106|271=0|58=5DT5TR1CI676C1|10=064|

Market Data – Order Book End of Book (MsgType = X)

End of Book messages have the following format

Tag Field Name Comments
Standard Header MsgType = X
262 MDReqID The MDReqID of the MarketDataRequest message.
268 NoMDEntries Number of market data entries in this snapshot. “1” for this message.
279 MDUpdateAction The Market Data update action type. Will be “1” Change for this message.
269 MDEntryType Type of market data entry. 2 = Trade for this message.
278 MDEntryID Market data identifier
55 Symbol “*” for this message type.
270 MDEntryPx “0” for this message.
271 MDEntrySize “0” for this message.
Standard Trailer

Example FIX Message

End of Book messages are denoted with a 55 = “*” as shown below.

8=FIX.4.2|9=125|35=X|49=USERID|56=USERID1|34=61| 52=20190131-23:48:52.336|262=0|268=1|279=1|269=2| 278=9223372036854775807| 55=* |270=0.0|271=0|10=176|

Note: Although itBit Market Data Gateway is not currently configured to store FIX messages per user (and as such not supporting resend requests), it is possible when logging on and getting the full book to receive Market Data Entries where the MDUpdateAction = Change. This is to be ignored prior to the End of Book message as all market data entries prior to receiving the End of Book message should be treated as “New.”

Market Data Request Reject (MsgType = Y)

Tag Field Name Comments
Standard Header MsgType = Y
262 MDReqID The MDReqID of the MarketDataRequest message.
58 Text Reason for the rejection.
Standard Trailer

Generated by aglio on 27 Jun 2019