chore: use safe_value_fallback to get currency rate

This commit is contained in:
Matthias
2024-12-18 06:34:51 +01:00
parent d559572718
commit 7b1ea81a27

View File

@@ -1903,7 +1903,7 @@ class Exchange:
)
ticker = tickers_other.get(pair, None)
if ticker:
rate: float | None = ticker.get("last", None)
rate: float | None = safe_value_fallback2(ticker, ticker, "last", "ask", None)
if rate and pair.startswith(currency) and not pair.endswith(currency):
rate = 1.0 / rate
return rate