mod exchanges;
use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use strum_macros::{Display, EnumString};
#[repr(C)]
#[derive(Copy, Clone, Eq, PartialEq, Serialize, Deserialize, Display, Debug, EnumString, Hash)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum MessageType {
Other,
Trade,
L2Event,
L2Snapshot,
#[serde(rename = "l2_topk")]
#[strum(serialize = "l2_topk")]
L2TopK,
L3Event,
L3Snapshot,
#[serde(rename = "bbo")]
#[allow(clippy::upper_case_acronyms)]
BBO,
Ticker,
Candlestick,
FundingRate,
OpenInterest,
LongShortRatio,
TakerVolume,
}
pub fn get_ws_commands(
exchange: &str,
msg_types: &[MessageType],
symbols: &[String],
subscribe: bool,
configs: Option<&HashMap<String, String>>,
) -> Vec<String> {
if msg_types.is_empty() || symbols.is_empty() {
return Vec::new();
}
match exchange {
"binance" => exchanges::binance::get_ws_commands(msg_types, symbols, subscribe, configs),
"bitfinex" => exchanges::bitfinex::get_ws_commands(msg_types, symbols, subscribe, configs),
"bitmex" => exchanges::bitmex::get_ws_commands(msg_types, symbols, subscribe, configs),
"bybit" => exchanges::bybit::get_ws_commands(msg_types, symbols, subscribe, configs),
"deribit" => exchanges::deribit::get_ws_commands(msg_types, symbols, subscribe, configs),
"ftx" => exchanges::ftx::get_ws_commands(msg_types, symbols, subscribe, configs),
"huobi" => exchanges::huobi::get_ws_commands(msg_types, symbols, subscribe, configs),
"okex" => exchanges::okex::get_ws_commands(msg_types, symbols, subscribe, configs),
"okx" => exchanges::okx::get_ws_commands(msg_types, symbols, subscribe, configs),
_ => Vec::new(),
}
}