Function crypto_pair::normalize_pair[][src]

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

Normalize a cryptocurrency trading pair.

Arguments

  • symbol - 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("btcusdt", "huobi"));
assert_eq!(Some("BTC/USDT".to_string()), normalize_pair("BTCUST", "bitfinex"));