pub fn get_market_type(
    symbol: &str,
    exchange: &str,
    is_spot: Option<bool>
) -> MarketType
Expand description

Infer out market type from the symbol.

The is_spot parameter is not needed in most cases, but at some exchanges (including binance, gate and mexc) a symbol might exist in both spot and contract markets, for example:

  • At binance BTCUSDT exists in both spot and linear_swap markets
  • At gate BTC_USDT exists in both spot and linear_swap markets, BTC_USD exists in both spot and inverse_swap markets