[][src]Function crypto_pair::normalize_pair

pub fn normalize_pair(raw_pair: &str, exchange: &str) -> Option<String>

Normalize a cryptocurrency trade pair.

Arguments

  • raw_pair - The original pair of an exchange
  • exchange - 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("btc_usdt", "Huobi"));
assert_eq!(Some("BTC_USDT".to_string()), normalize_pair("btcust", "Bitfinex"));