pub struct BitgetSymbolConverter;Expand description
Bitget symbol converter.
Provides methods to convert between unified CCXT symbols and Bitget-specific exchange IDs, and to determine the appropriate product type.
Implementations§
Source§impl BitgetSymbolConverter
impl BitgetSymbolConverter
Sourcepub fn unified_to_exchange(symbol: &str) -> String
pub fn unified_to_exchange(symbol: &str) -> String
Convert a unified CCXT symbol to Bitget exchange ID.
Strips the settlement currency suffix and removes separators:
- “BTC/USDT” → “BTCUSDT”
- “BTC/USDT:USDT” → “BTCUSDT”
- “BTC/USD:BTC” → “BTCUSD”
- “BTC/USDT:USDT-241231” → “BTCUSDT”
Sourcepub fn product_type_from_symbol(symbol: &str) -> &'static str
pub fn product_type_from_symbol(symbol: &str) -> &'static str
Determine the Bitget product type from a unified symbol.
Returns:
- “USDT-FUTURES” for linear perpetual/futures (e.g., “BTC/USDT:USDT”)
- “COIN-FUTURES” for inverse perpetual/futures (e.g., “BTC/USD:BTC”)
- “spot” for spot markets (e.g., “BTC/USDT”)
Sourcepub fn is_contract(symbol: &str) -> bool
pub fn is_contract(symbol: &str) -> bool
Check if a symbol is a contract (has settlement currency).
Sourcepub fn exchange_to_unified_hint(exchange_id: &str, product_type: &str) -> String
pub fn exchange_to_unified_hint(exchange_id: &str, product_type: &str) -> String
Convert a Bitget exchange ID back to a rough unified symbol hint.
This is a best-effort conversion:
- “BTCUSDT” with product_type “USDT-FUTURES” → “BTC/USDT:USDT”
- “BTCUSD” with product_type “COIN-FUTURES” → “BTC/USD:BTC”
- “BTCUSDT” with product_type “spot” → “BTC/USDT”
Auto Trait Implementations§
impl Freeze for BitgetSymbolConverter
impl RefUnwindSafe for BitgetSymbolConverter
impl Send for BitgetSymbolConverter
impl Sync for BitgetSymbolConverter
impl Unpin for BitgetSymbolConverter
impl UnsafeUnpin for BitgetSymbolConverter
impl UnwindSafe for BitgetSymbolConverter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more