This documentation is archived for reference only. These APIs have been replaced by the new WebSocket API . Start new integrations with the new WebSocket API.
Multi market data is a public API which allows multiple symbols to be streamed via a single endpoint.
WebSocket Request
wss://api.gemini.com/v1/multimarketdata?symbols=BTCUSD,ETHUSD
URL Parameters
Parameter Required Default Description symbolsYes - Symbols to stream (comma-separated) heartbeatNo false Set to true for heartbeats every 5 seconds top_of_bookNo false If true, receive top of book only bidsNo true Include bids in change events offersNo true Include asks in change events tradesNo true Include trade events
Response
Field Type Description typestring heartbeat or updatesocket_sequenceinteger Monotonic increasing sequence number
Messages of type update also include:
Field Type Description eventIdinteger Monotonically increasing sequence number eventsarray Order book changes or trade indications timestamptimestamp Timestamp in seconds timestampmstimestampms Timestamp in milliseconds
All elements of events share:
Field Type Description typestring trade or changesymbolstring Symbol (e.g. BTCUSD, ETHUSD)
Change Event
Field Type Description pricedecimal Price of this order book entry sidestring bid or askreasonstring place, trade, cancel, or initialremainingdecimal Quantity remaining at this price level deltadecimal Quantity changed
Trade Event
Field Type Description pricedecimal Execution price amountdecimal Amount traded makerSidestring bid or ask
Examples
import ssl
import websocket
def on_message (ws, message):
print (message)
ws = websocket.WebSocketApp(
"wss://api.gemini.com/v1/multimarketdata?symbols=BTCUSD,ETHUSD" ,
on_message = on_message)
ws.run_forever( sslopt = { "cert_reqs" : ssl. CERT_NONE })
Trade Event
{
"type" : "update" ,
"eventId" : 5375547515 ,
"timestamp" : 1547760288 ,
"timestampms" : 1547760288001 ,
"socket_sequence" : 15 ,
"events" : [
{
"type" : "trade" ,
"tid" : 5375547515 ,
"price" : "3632.54" ,
"amount" : "0.1362819142" ,
"makerSide" : "ask" ,
"symbol" : "BTCUSD"
}
]
}