refactor: invert balance logic to simplify function
This commit is contained in:
@@ -73,15 +73,8 @@ class Krakenfutures(Exchange):
|
||||
|
||||
# Only synthesize USD if stake_currency is USD
|
||||
stake = str(self._config.get("stake_currency", "")).upper()
|
||||
if stake != "USD":
|
||||
# Skip USD synthesis for non-USD stake 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
|
||||
|
||||
if stake == "USD":
|
||||
# Only synthesize if USD stake - flex only applies for these currencies.
|
||||
# For flex accounts, synthesize USD balance from margin values
|
||||
info = balances.get("info", {})
|
||||
accounts = info.get("accounts", {}) if isinstance(info, dict) else {}
|
||||
|
||||
Reference in New Issue
Block a user