Get real-time spot orderbook via websocket stream (with timestamp)

hello.
I would like to receive symbols of multiple spots via websocket stream.
As I understand it, biannce is providing the orderbook of future market using websocket with timestamp.
But the orderbook of SPOT market does not provide timestamp.

future orderbook stream : Binance API Documentation
spot orderbook stream : Binance API Documentation

It is very important to see the timestamp to check the time delay. However, it seems difficult to check the timestamp of spot using partial-book-detph websocket at the moment.
I think a possible way is to use spot’s diff-depth-stream to get the real-time orderbook and get the timestamp at the same time.

I would like to ask if anyone has a good example of the above method?
Or is there any way to get the spot orderbook via websocket stream with timestamp?
Thanks in advance.

Using the diff-depth stream for the spot market is a viable solution, as it provides both the last update ID and the event time, which can serve as a timestamp indicating when the last change occurred.

Python example using the websocket-client library to subscribe to the diff-depth stream for a specific symbol (e.g., btcusdt). This example prints the order book updates along with the timestamps:

import websocket
import json

def on_message(ws, message):
data = json.loads(message)
print(“Timestamp:”, data[‘E’]) # Event time
print(“Last Update ID:”, data[‘u’]) # Last update ID of the order book
print(“Bids:”, data[‘b’]) # List of all bids
print(“Asks:”, data[‘a’]) # List of all asks
print(“----”)

def on_error(ws, error):
print(error)

def on_close(ws, close_status_code, close_msg):
print(“### closed ###”)

def on_open(ws):
print(“Opened connection”)
# Subscribe to the diff. depth stream
param = {
“method”: “SUBSCRIBE”,
“params”: [
“btcusdt@depth”
],
“id”: 1
}
ws.send(json.dumps(param))

if name == “main”:
websocket.enableTrace(True)
ws = websocket.WebSocketApp(“wss://stream.binance.com:9443/ws”,
on_open=on_open,
on_message=on_message,
on_error=on_error,
on_close=on_close)

ws.run_forever()