GeminiGemini
SandboxGet API key
  • Crypto Trading
  • Prediction Markets
Changelog
Gemini Crypto Exchange LogoGemini Crypto Exchange Logo

© 2026 Gemini Space Station, Inc.

Market Data v2 (Archived)

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.

Market Data v2

The initial response will show the existing state of the order books and last 50 trades. Subsequent messages show all executed trades and order book changes.

WebSocket Request

wss://api.gemini.com/v2/marketdata

After connecting, subscribe by sending a message:

Field NameTypeValues
typestringsubscribe
subscriptionsarray
-- namestringl2, candles_1m, candles_5m, candles_15m, candles_30m, candles_1h, candles_6h, candles_1d
-- symbolsarray["BTCUSD", "ETHBTC", ...]

Subscription Example

Code
{ "type": "subscribe", "subscriptions": [ { "name": "l2", "symbols": ["BTCUSD", "ETHUSD"] } ] }
Code
import ssl, websocket, _thread as thread def on_message(ws, message): print(message) def on_open(ws): def run(*args): ws.send('{"type": "subscribe","subscriptions":[{"name":"l2","symbols":["BTCUSD","ETHUSD"]}]}') thread.start_new_thread(run, ()) ws = websocket.WebSocketApp("wss://api.gemini.com/v2/marketdata", on_message=on_message, on_open=on_open) ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE})

Unsubscribe

Code
{ "type": "unsubscribe", "subscriptions": [ { "name": "l2", "symbols": ["BTCUSD", "ETHBTC"] } ] }

Level 2 Data

L2 Update Response

Field NameTypeValues
typestringl2_updates
symbolstringBTCUSD, etc.
changesarray of arrays[side, price, quantity]

Trade Response

Field NameTypeValues
typestringtrade
symbolstringBTCUSD, etc.
event_idlongEvent ID of the trade
timestamplongTime in milliseconds
pricestringPrice of the trade
quantitystringQuantity traded
sidestringTaker side: buy or sell
tidlongTrade ID

Examples

Initial L2 response:

Code
{ "type": "l2_updates", "symbol": "BTCUSD", "changes": [ ["buy", "9122.04", "0.00121425"], ["sell", "9122.07", "0.98942292"] ], "trades": [ { "type": "trade", "symbol": "BTCUSD", "eventid": 169841458, "timestamp": 1560976400428, "price": "9122.04", "quantity": "0.0073173", "side": "sell", "tid": 2840140800042677 } ] }

L2 update:

Code
{ "type": "l2_updates", "symbol": "BTCUSD", "changes": [["sell", "9160.20", "0.1921229751"]] }

Candles Data Feed

The Candle Data feed provides periodic updates with OHLCV data for the given timeframe.

Subscribe

Field NameTypeValues
typestringsubscribe
subscriptionsarray
-- namestringcandles_1m, candles_5m, candles_15m, candles_30m, candles_1h, candles_6h, candles_1d
-- symbolsarray["BTCUSD", ...]

Response

Field NameTypeValues
typestringcandles_1m_updates, candles_5m_updates, etc.
symbolstringBTCUSD, etc.
changesarray of arrays[time, open, high, low, close, volume]
Code
{ "type": "subscribe", "subscriptions": [ { "name": "candles_15m", "symbols": ["BTCUSD"] } ] }
Code
{ "type": "candles_15m_updates", "symbol": "BTCUSD", "changes": [ [1561054500000, 9350.18, 9358.35, 9350.18, 9355.51, 2.07], [1561053600000, 9357.33, 9357.33, 9350.18, 9350.18, 1.5900161] ] }

Mark Price Feed

The mark price feed provides mark price updates for perpetual instruments and select spot pairs.

Subscribe

Field NameTypeValues
typestringsubscribe
subscriptionsarray
-- namestringmark_price
-- symbolsarray["BTCGUSDPERP", "BTCUSD", ...]

Response

Field NameTypeValues
typestringmark_price_updates
symbolstringBTCGUSDPERP
changesarray

Each element of changes:

Field NameTypeValues
timestampintegernanoseconds
mark_pricestringmark price
spot_indexstringspot index
Code
{ "type": "mark_price_updates", "symbol": "BTCGUSDPERP", "changes": [ { "timestamp": 1673932381478308169, "mark_price": "21154.098", "spot_index": "21175.27333" } ] }

Funding Amount Feed

The Funding Amount feed provides funding amount updates for perpetual instruments.

Subscribe

Field NameTypeValues
typestringsubscribe
subscriptionsarray
-- namestringfunding_amount
-- symbolsarray["BTC-GUSD-PERP", ...]

Response

Field NameTypeValues
typestringfunding_amount_updates
symbolstringBTCGUSDPERP
changesarray

Each element of changes:

Field NameTypeValues
timestampintegernanoseconds
funding_amountstringfunding amount
funding_date_timeintegerfunding date time
funding_interval_in_minutesintegerfunding interval in minutes
is_realizedbooleanis realized funding
Code
{ "type": "funding_amount_updates", "symbol": "BTCGUSDPERP", "changes": [ { "timestamp": 1673932380007696874, "funding_amount": "0", "funding_date_time": 1673932380007696874, "funding_interval_in_minutes": 60, "is_realized": false } ] }
Last modified on May 5, 2026
On this page
  • WebSocket Request
    • Subscription Example
  • Unsubscribe
  • Level 2 Data
    • L2 Update Response
    • Trade Response
    • Examples
  • Candles Data Feed
    • Subscribe
    • Response
  • Mark Price Feed
    • Subscribe
    • Response
  • Funding Amount Feed
    • Subscribe
    • Response
JSON
JSON
JSON
JSON
JSON
JSON
JSON
JSON