Examples
Market Data Requests
These are some examples of FIX market data requests. These requests only need to be made once per session to setup a FIX connection for market data.
Notes:
- SubscriptionRequestType
<263>
=1 SNAPSHOT_PLUS_UPDATES
allows the sender to subscribe to the data feed and receive updates.
Top of Book (Bids)
This is a request for the Top of Book BTCUSD bids and its response:
Request
RAW 8=FIX.4.4|9=114|35=V|34=2|49=TRADEBOTMD002|52=20180425-17:51:40.000|56=GEMINI|262=2|263=1|264=1|146=1|55=BTCUSD|267=1|269=0|10=016| HEADER 8 BeginString: FIX.4.4 9 BodyLength: 114 34 MsgSeqNum: 2 35 MsgType: MarketDataRequest (V) 49 SenderCompID: TRADEBOTMD002 52 SendingTime: 20180425-17:51:40.000 56 TargetCompID: GEMINI BODY 262 MDReqID: 2 263 SubscriptionRequestType: SNAPSHOT_PLUS_UPDATES (1) 264 MarketDepth: TOP_OF_BOOK (1) 146 NoRelatedSym: count = 1 55 Symbol: BTCUSD 267 NoMDEntryTypes: count = 1 269 MDEntryType: BID (0) TRAILER 10 CheckSum: 016txt
Response
RAW 8=FIX.4.4|9=108|35=W|34=2|49=GEMINI|52=20180425-17:51:40.787|56=TRADEBOTMD002|55=BTCUSD|262=2|268=1|269=0|270=8490.07|271=1|10=075| HEADER 8 BeginString: FIX.4.4 9 BodyLength: 108 34 MsgSeqNum: 2 35 MsgType: MarketDataSnapshotFullRefresh (W) 49 SenderCompID: GEMINI 52 SendingTime: 20180425-17:51:40.787 56 TargetCompID: TRADEBOTMD002 BODY 55 Symbol: BTCUSD 262 MDReqID: 2 268 NoMDEntries: count = 1 269 MDEntryType: BID (0) 270 MDEntryPx: 8490.07 271 MDEntrySize: 1 TRAILER 10 CheckSum: 075txt
Trades
This is a request for all ETHBTC trades:
Request
RAW 8=FIX.4.4|9=114|35=V|34=2|49=TRADEBOTMD002|52=20180425-17:55:30.000|56=GEMINI|262=2|263=1|264=0|146=1|55=ETHBTC|267=1|269=2|10=009| HEADER 8 BeginString: FIX.4.4 9 BodyLength: 114 34 MsgSeqNum: 2 35 MsgType: MarketDataRequest (V) 49 SenderCompID: TRADEBOTMD002 52 SendingTime: 20180425-17:55:30.000 56 TargetCompID: GEMINI BODY 262 MDReqID: 2 263 SubscriptionRequestType: SNAPSHOT_PLUS_UPDATES (1) 264 MarketDepth: FULL_BOOK (0) 146 NoRelatedSym: count = 1 55 Symbol: ETHBTC 267 NoMDEntryTypes: count = 1 269 MDEntryType: TRADE (2) TRAILER 10 CheckSum: 009txt
Request - Multiple Symbols
This is a request for the Top of Book BTCUSD, ETHUSD, and ETHBTC bids:
RAW 8=FIX.4.4|9=134|35=V|34=2|49=TRADEBOTMD002|52=20180425-17:55:38.000|56=GEMINI|262=2|263=1|264=1|146=3|55=BTCUSD|55=ETHUSD|55=ETHBTC|267=1|269=0|10=246| HEADER 8 BeginString: FIX.4.4 9 BodyLength: 134 34 MsgSeqNum: 2 35 MsgType: MarketDataRequest (V) 49 SenderCompID: TRADEBOTMD002 52 SendingTime: 20180425-17:55:38.000 56 TargetCompID: GEMINI BODY 262 MDReqID: 2 263 SubscriptionRequestType: SNAPSHOT_PLUS_UPDATES (1) 264 MarketDepth: TOP_OF_BOOK (1) 146 NoRelatedSym: count = 3 55 Symbol: BTCUSD ---- 55 Symbol: ETHUSD ---- 55 Symbol: ETHBTC 267 NoMDEntryTypes: count = 1 269 MDEntryType: BID (0) TRAILER 10 CheckSum: 246txt
Responses
and the corresponding responses:
RAW 8=FIX.4.4|9=108|35=W|34=2|49=GEMINI|52=20180425-17:55:39.151|56=TRADEBOTMD002|55=BTCUSD|262=2|268=1|269=0|270=8490.07|271=1|10=072| HEADER 8 BeginString: FIX.4.4 9 BodyLength: 108 34 MsgSeqNum: 2 35 MsgType: MarketDataSnapshotFullRefresh (W) 49 SenderCompID: GEMINI 52 SendingTime: 20180425-17:55:39.151 56 TargetCompID: TRADEBOTMD002 BODY 55 Symbol: BTCUSD 262 MDReqID: 2 268 NoMDEntries: count = 1 269 MDEntryType: BID (0) 270 MDEntryPx: 8490.07 271 MDEntrySize: 1 TRAILER 10 CheckSum: 072txt
and:
RAW 8=FIX.4.4|9=107|35=W|34=3|49=GEMINI|52=20180425-17:55:39.151|56=TRADEBOTMD002|55=ETHUSD|262=2|268=1|269=0|270=587.35|271=1|10=032| HEADER 8 BeginString: FIX.4.4 9 BodyLength: 107 34 MsgSeqNum: 3 35 MsgType: MarketDataSnapshotFullRefresh (W) 49 SenderCompID: GEMINI 52 SendingTime: 20180425-17:55:39.151 56 TargetCompID: TRADEBOTMD002 BODY 55 Symbol: ETHUSD 262 MDReqID: 2 268 NoMDEntries: count = 1 269 MDEntryType: BID (0) 270 MDEntryPx: 587.35 271 MDEntrySize: 1 TRAILER 10 CheckSum: 032txt
and:
RAW 8=FIX.4.4|9=115|35=W|34=4|49=GEMINI|52=20180425-17:55:39.152|56=TRADEBOTMD002|55=ETHBTC|262=2|268=1|269=0|270=0.06896|271=0.004008|10=152| HEADER 8 BeginString: FIX.4.4 9 BodyLength: 115 34 MsgSeqNum: 4 35 MsgType: MarketDataSnapshotFullRefresh (W) 49 SenderCompID: GEMINI 52 SendingTime: 20180425-17:55:39.152 56 TargetCompID: TRADEBOTMD002 BODY 55 Symbol: ETHBTC 262 MDReqID: 2 268 NoMDEntries: count = 1 269 MDEntryType: BID (0) 270 MDEntryPx: 0.06896 271 MDEntrySize: 0.004008 TRAILER 10 CheckSum: 152txt
Enable Maker Side on Trades
To enable showing the maker side of trades, create a Market Data Request <V>
with custom field EnableMDEntryMakerSide <9003>
enabled.
When trades occur, custom field MDEntryMakerSide <9002>
will appear in the MDEntry group with the market side of the trade. See Examples: Showing Maker Side For Trades.
RAW 8=FIX.4.4|9=121|35=V|34=2|49=TRADEBOTMD002|52=20180809-15:59:14.000|56=GEMINI|262=2|263=1|264=1|9003=Y|146=1|55=BTCUSD|267=1|269=2|10=128| HEADER 8 BeginString: FIX.4.4 9 BodyLength: 121 34 MsgSeqNum: 2 35 MsgType: MarketDataRequest (V) 49 SenderCompID: TRADEBOTMD002 52 SendingTime: 20180809-15:59:14.000 56 TargetCompID: GEMINI BODY 262 MDReqID: 2 263 SubscriptionRequestType: SNAPSHOT_PLUS_UPDATES (1) 264 MarketDepth: TOP_OF_BOOK (1) 9003 EnableMDEntryMakerSide: Y 146 NoRelatedSym: count = 1 55 Symbol: BTCUSD 267 NoMDEntryTypes: count = 1 269 MDEntryType: TRADE (2) TRAILER 10 CheckSum: 128txt