from __future__ import annotations import pytest from cerbero_mcp.exchanges.cross.symbol_map import ( get_sources, to_native_interval, to_native_symbol, ) def test_btc_crypto_sources(): assert set(get_sources("crypto", "BTC")) == {"bybit", "hyperliquid", "deribit"} def test_eth_crypto_sources(): assert set(get_sources("crypto", "ETH")) == {"bybit", "hyperliquid", "deribit"} def test_unknown_crypto_symbol_returns_empty(): assert get_sources("crypto", "DOGEFAKE") == [] def test_stocks_aapl_sources(): assert set(get_sources("stocks", "AAPL")) == {"alpaca"} def test_native_symbol_btc(): assert to_native_symbol("crypto", "BTC", "bybit") == "BTCUSDT" assert to_native_symbol("crypto", "BTC", "hyperliquid") == "BTC" assert to_native_symbol("crypto", "BTC", "deribit") == "BTC-PERPETUAL" def test_native_symbol_unsupported_pair_raises(): with pytest.raises(KeyError): to_native_symbol("crypto", "BTC", "alpaca") def test_native_interval_1h(): assert to_native_interval("1h", "bybit") == "60" assert to_native_interval("1h", "hyperliquid") == "1h" assert to_native_interval("1h", "deribit") == "1h" assert to_native_interval("1h", "alpaca") == "1h" def test_native_interval_unknown_canonical_raises(): with pytest.raises(KeyError): to_native_interval("3h", "bybit")