crypto_pair/exchanges/
zbg.rs1use crypto_market_type::MarketType;
2
3pub(crate) fn normalize_pair(symbol: &str) -> Option<String> {
4 if symbol.ends_with("_USD-R") {
5 let base = symbol.strip_suffix("_USD-R").unwrap();
6 Some(format!("{base}/USD"))
7 } else {
8 Some(symbol.replace('_', "/").to_uppercase())
9 }
10}
11
12pub(crate) fn get_market_type(symbol: &str) -> MarketType {
13 if symbol.ends_with("_USD-R") {
14 MarketType::InverseSwap
15 } else if symbol.ends_with("_USDT") || symbol.ends_with("_ZUSD") {
16 MarketType::LinearSwap
17 } else {
18 MarketType::Spot
19 }
20}