Gate Perpetual Depth Channel Upgrade Announcement

2025-05-13 11:00:27 UTC
170.721 visualizações

To enhance the trading experience, Gate will soon launch a new depth channel
futures.obu for the USDT-margined perpetual futures. This new channel features optimized push logic and expanded depth levels. The details are as follows:

1.Channel Details

  • Name:futures.obu
  • Parameter format:ob.{symbol}.{level}
    Examples:ob.BTC_USDT.400(400 levels)、ob.BTC_USDT.50(50 levels)
  • Levels and update frequency:
    400 levels: updated every 100ms
    50 levels: updated every 20ms

2.Subscription and Push Rules

  • 1.Full Depth Push (full=true): When the channel pushes a full depth update, the received depth data should completely replace the local depth, and the depth ID must be updated to the u field from the message. The server may resend full depth updates.

    • Upon subscribing to the channel, the first push will always be a full depth update.
  • 2.Incremental Depth Push (full=false): Incremental depth messages do not include the "full" field. Instead, the message contains "U" (the starting depth ID) and "u" (the ending depth ID).

    • If U = local depth ID + 1, the depth update is continuous:
      Replace the local depth ID with the "u" value from the message.
      If the "a" and "b" fields in the update are not empty, update the corresponding ask/bid sizes by price (level[0] is price, level[1] is size). If level[1] = "0", remove the corresponding price level from the local depth.
    • If U ≠ local depth ID + 1, the depth data is not continuous. In this case, unsubscribe from the symbol and resubscribe to obtain an initial full depth snapshot.
  • 3.Subscription Limits: For the same depth stream of the same contract, only one subscription per connection is allowed. Duplicate subscriptions will return an error, e.g.:

{ "error": { "code": 2, "message": "Alert sub ob.BTC_USDT.50" } }

3. Examples of Operations and Data Push

  • 3.1 Subscription

Subscription request example

from websocket import create_connection 
import json 

ws = create_connection("wss://ws-testnet.gate.io/v4/ws/futures/usdt") 

subscribe_msg = {"time": 1747054611, "channel": "futures.obu", "event": "subscribe", "payload": ["ob.BTC_USDT.50"]} 

ws.send(json.dumps(subscribe_msg)) 
print(ws.recv())

Subscription success response example

{"time":1747054611,"time_ms":1747054611614,"conn_id":"d7de96c024f2a5b2","trace_id":"e6fd9bdd617fcdb80d0762ffa33e71f6","channel":"futures.obu","event":"subscribe","payload":["ob.BTC_USDT.50"],"result":{"status":"success"}}

Full depth push example

{"channel":"futures.obu","result":{"t":1747054612673,"full":true,"s":"ob.BTC_USDT.50","u":73777715168,"b":[["104027.1","509392"],["104027","477932"],["104026.9","495268"],["104026.7","32736"],["104026.5","34203"],["104026.3","41574"],["104026.1","38304"],["104025.9","32032"],["104025.7","37002"],["104025.5","34533"],["104025.3","33314"],["104025.1","35940"],["104024.9","45910"],["104024.7","35976"],["104024.5","43786"],["104024.3","48071"],["104016.7","41323"],["104006.3","43951"],["103995.9","33242"],["103985.5","41970"],["103975.1","42491"],["103964.7","37901"],["103954.3","39813"],["103943.9","36248"],["103933.5","39625"],["103923.1","39711"],["103912.7","33346"],["103902.3","31525"],["103891.9","34768"],["103881.5","43964"],["103871.1","43706"],["102897.6","1"],["11000","44782"]],"a":[["104027.2","44617"],["104027.4","39322"],["104027.6","41485"],["104027.8","31237"],["104028","31186"],["104028.2","46392"],["104028.4","35450"],["104028.6","36521"],["104028.8","32805"],["104029","41248"],["104029.2","39116"],["104029.4","40685"],["104029.6","37907"],["104029.8","40635"],["104030","38132"],["104037.6","29238"],["104048","38673"],["104058.4","39043"],["104068.8","45300"],["104079.2","45954"],["104089.6","39731"],["104100","44410"],["104110.4","37043"],["104120.8","31646"],["104131.2","32643"],["104141.6","40837"],["104152","42588"],["104162.4","45369"],["104172.8","30834"],["104183.2","41898"],["108000","699"],["100000000","10"]]},"time_ms":1747054612848}

Incremental push example

{"channel":"futures.obu","result":{"t":1747054612695,"s":"ob.BTC_USDT.50","U":73777715169,"u":73777715212,"b":[["104024.5","10343"],["104014.5","509392"],["104014.3","477932"],["104012.6","33314"],["104012.5","15215"],["104011.6","48071"],["104027.1","0"],["104027","0"],["104026.9","0"],["104026.7","0"],["104026.5","0"],["104026.3","0"],["104026.1","0"],["104025.9","0"],["104025.7","0"],["104025.5","0"],["104025.3","0"],["104025.1","0"],["104024.9","0"],["104024.7","0"],["104024.3","0"]],"a":[["104027.2","0"],["104027.4","0"],["104027.6","0"],["104027.8","0"],["104028.2","0"],["104028.4","0"],["104028.6","0"],["104028.8","0"],["104029.2","0"],["104029.6","0"],["104029.8","0"],["104030","0"]]},"time_ms":1747054612925}
  • 3.2 Unsubscribe

Unsubscribe request example

from websocket import create_connection
import json 

ws = create_connection("wss://ws-testnet.gate.io/v4/ws/futures/usdt") 

unsubscribe_msg = {"time": 123456, "channel": "futures.obu", "event": "unsubscribe", "payload": ["ob.BTC_USDT.50"]} 

ws.send(json.dumps(unsubscribe_msg)) 
print(ws.recv())

Unsubscribe response example

{"time": 1743673617,"time_ms": 1743673617242,"id": 1,"conn_id": "7b06ff199a98ab0e","trace_id": "8f86e4021a84440e502f73fde5b94918","channel": "futures.obu","event": "unsubscribe","payload": ["ob.BTC_USDT.50"],"result": {"status": "success"}}

4.Testnet Notice
This feature has been launched on the perpetual futures testnet. Please connect for testing via the following URL:
WebSocket USDT-margined perpetual futures testnet URL:
wss://ws-testnet.gate.io/v4/ws/futures/usdt

Please adjust your integration according to the new rules. If you have any questions, please contact our support team.

Gate Team May 13, 2025 **Gateway to Crypto** Trade over 4,300 cryptocurrencies safely, quickly, and easily on Gate **Take Action Now** Sign up and claim up to $10,000 in welcome rewards Invite friends and earn a 40% commission **Stay Connected** Visit Gate's official website Download the Gate App | Desktop Follow us on X (Twitter) to get more bonuses Join our Telegram community to discuss trending topics Engage with our global community for the latest insights **Transparency & Security** Check our 100% Proof of Reserves