refactor: invert balance logic to simplify function

This commit is contained in:
Matthias
2026-02-12 19:51:26 +01:00
parent b190079aa8
commit b25defb8b9
+2 -9
View File
@@ -73,15 +73,8 @@ class Krakenfutures(Exchange):
# Only synthesize USD if stake_currency is USD # Only synthesize USD if stake_currency is USD
stake = str(self._config.get("stake_currency", "")).upper() stake = str(self._config.get("stake_currency", "")).upper()
if stake != "USD": if stake == "USD":
# Skip USD synthesis for non-USD stake currencies # Only synthesize if USD stake - flex only applies for these currencies.
balances.pop("info", None)
balances.pop("free", None)
balances.pop("total", None)
balances.pop("used", None)
self._log_exchange_response("fetch_balance", balances, add_info=params)
return balances
# For flex accounts, synthesize USD balance from margin values # For flex accounts, synthesize USD balance from margin values
info = balances.get("info", {}) info = balances.get("info", {})
accounts = info.get("accounts", {}) if isinstance(info, dict) else {} accounts = info.get("accounts", {}) if isinstance(info, dict) else {}