To enhance the trading experience, Gate will soon launch a new depth channel spot.obu for spot trading. This new channel features optimized push logic and expanded depth levels. The details are as follows:
1. Channel Details
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.
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).
3. Subscription Limits
For the same depth stream of the same currency pair, 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
1.Subscription
1.1Subscription request example
from websocket import create_connection
import json
ws = create_connection("wss://ws-testnet.gate.io/v4/ws/spot")
subscribe_msg = {"time": 1748572393, "channel": "spot.obu", "event": "subscribe", "payload": ["ob.BTC_USDT.50"]}
ws.send(json.dumps(subscribe_msg))
print(ws.recv())
1.2 Subscription success response example
{"time":1748572394,"time_ms":1748572394271,"conn_id":"b61f70b2e6bcca91","trace_id":"d2e2d92c3a7eabc3d5be52514ef508d2","channel":"spot.obu","event":"subscribe","payload":["ob.BTC_USDT.50"],"result":{"status":"success"},"requestId":"d2e2d92c3a7eabc3d5be52514ef508d2"}
1.3 depth push example
{"channel":"spot.obu","result":{"t":1748572394325,"full":true,"s":"ob.BTC_USDT.50","u":28606981,"b":[["105958.9","0.00908"],["105953.2","0.02426"],["105942.6","0.02074"],["105937.7","0.0099"],["105932","0.01731"],["105927.1","0.01796"],["105921.4","0.02041"],["105893.2","0.01265"],["105872","0.01895"],["70000","0.00005"],["49000.1","0.0002"],["66","0.05"]],"a":[["106009.9","0.01555"],["106038.1","0.00648"],["106048.7","0.01751"],["106059.3","0.00198"],["106080.5","0.01861"],["106091.1","0.02018"],["106101.7","0.01548"],["106112.3","0.01776"],["106122.9","0.01546"],["106133.5","0.02117"]]},"time_ms":1748572394325,"event":"update"}
1.4 Incremental push example
{"channel":"spot.obu","result":{"t":1748572395237,"s":"ob.BTC_USDT.50","u":28606989,"U":28606988,"b":[["66","0"]],"a":[["106009.9","0"]]},"time_ms":1748572395237,"event":"update"}
2. Unsubscribe
2.1 Unsubscribe request example
from websocket import create_connection
import json
ws = create_connection("wss://ws-testnet.gate.io/v4/ws/spot")
unsubscribe_msg = {"time": 1747054611, "channel": "spot.obu", "event": "unsubscribe", "payload": ["ob.BTC_USDT.50"]}
ws.send(json.dumps(unsubscribe_msg))
print(ws.recv())
2.2 Unsubscribe response example
{"time": 1743673617,"time_ms": 1743673617242,"id": 1,"conn_id": "7b06ff199a98ab0e","trace_id": "8f86e4021a84440e502f73fde5b94918","channel": "spot.obu","event": "unsubscribe","payload": ["ob.BTC_USDT.50"],"result": {"status": "success"}}
4. Testnet Notice
This feature has been launched on the spot testnet. Please connect for testing via the following URL:
WebSocket spot testnet URL:
wss://ws-testnet.gate.io/v4/ws/spot
Please adjust your integration according to the new rules. If you have any questions, please contact our support team.
Gate Team May 30th, 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مشاركة المنشورات
مقالات ذات صلة