feat: conversion_rate should map both sides

This commit is contained in:
Matthias
2024-12-17 19:44:24 +01:00
parent 5a24292d34
commit dcc8c8800f
2 changed files with 4 additions and 0 deletions

View File

@@ -1884,6 +1884,8 @@ class Exchange:
if (proxy_coin := self._ft_has["proxy_coin_mapping"].get(coin, None)) is not None:
coin = proxy_coin
if (proxy_currency := self._ft_has["proxy_coin_mapping"].get(currency, None)) is not None:
currency = proxy_currency
if coin == currency:
return 1.0
tickers = self.get_tickers(cached=True)

View File

@@ -2050,6 +2050,8 @@ def test_get_conversion_rate(default_conf_usdt, mocker, exchange_name):
# Special binance case of BNFCR matching USDT.
assert exchange.get_conversion_rate("BNFCR", "USDT") is None
assert exchange.get_conversion_rate("BNFCR", "USDC") == 1
assert exchange.get_conversion_rate("USDT", "BNFCR") is None
assert exchange.get_conversion_rate("USDC", "BNFCR") == 1
@pytest.mark.parametrize("exchange_name", EXCHANGES)