crypto-msg-parser 1.0.1

Parse websocket messages
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mod gate_spot;
mod gate_swap;

use crypto_market_type::MarketType;

use crate::TradeMsg;

use serde_json::Result;

pub(crate) fn parse_trade(market_type: MarketType, msg: &str) -> Result<Vec<TradeMsg>> {
    if market_type == MarketType::Spot {
        gate_spot::parse_trade(msg)
    } else {
        gate_swap::parse_trade(market_type, msg)
    }
}