parse_ws_orderbook

Function parse_ws_orderbook 

Source
pub fn parse_ws_orderbook(data: &Value, symbol: String) -> Result<OrderBook>
Expand description

Parse WebSocket order book data from Binance depth stream.

§Arguments

  • data - WebSocket message JSON data
  • symbol - Trading pair symbol

§Returns

Returns a CCXT OrderBook structure.

§Example WebSocket Message

{
    "e": "depthUpdate",
    "E": 1579481530911,
    "s": "ETHBTC",
    "U": 157,
    "u": 160,
    "b": [
        ["0.0024", "10"]
    ],
    "a": [
        ["0.0026", "100"]
    ]
}