Function crypto_pair::normalize_pair
source · pub fn normalize_pair(symbol: &str, exchange: &str) -> Option<String>
Expand description
Normalize a cryptocurrency trading symbol.
§Arguments
symbol
- The original pair of an exchangeexchange
- The exchange name
§Examples
use crypto_pair::normalize_pair;
assert_eq!(Some("BTC/USD".to_string()), normalize_pair("XBTUSD", "bitmex"));
assert_eq!(Some("BTC/USD".to_string()), normalize_pair("XBTH21", "bitmex"));
assert_eq!(Some("BTC/USDT".to_string()), normalize_pair("BTCUSDT", "binance"));
assert_eq!(Some("BTC/USDT".to_string()), normalize_pair("btcusdt", "huobi"));
assert_eq!(Some("BTC/USDT".to_string()), normalize_pair("BTCUST", "bitfinex"));