crypto-msg-parser 2.9.2

Parse websocket messages from cryptocurreny exchanges
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;

// https://www.gateio.pro/docs/apiv4/ws/en/#server-response
// https://www.gateio.pro/docs/futures/ws/en/#response
// https://www.gateio.pro/docs/delivery/ws/en/#response
#[derive(Serialize, Deserialize)]
pub(super) struct WebsocketMsg<T: Sized> {
    pub time: i64,
    pub channel: String,
    pub event: String,
    pub error: Option<Value>,
    pub result: T,
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}