parse_ws_ohlcv

Function parse_ws_ohlcv 

Source
pub fn parse_ws_ohlcv(data: &Value) -> Result<OHLCV>
Expand description

Parse WebSocket OHLCV (candlestick/kline) data from Binance streams.

§Arguments

  • data - Kline object from WebSocket message JSON data

§Returns

Returns a CCXT OHLCV structure.

§Example WebSocket Message

{
    "e": "kline",
    "E": 1579481530911,
    "s": "ETHBTC",
    "k": {
        "t": 1579481400000,
        "T": 1579481459999,
        "s": "ETHBTC",
        "i": "1m",
        "f": 158251292,
        "L": 158414513,
        "o": "0.01916500",
        "c": "0.01912500",
        "h": "0.01956500",
        "l": "0.01887700",
        "v": "173518.11900000",
        "n": 163222,
        "x": false,
        "q": "3332.40703994",
        "V": "91515.47800000",
        "Q": "1757.42139293"
    }
}