Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions python/ccxt/async_support/probit.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,21 @@ def parse_balance(self, response) -> Balances:
'timestamp': None,
'datetime': None,
}
data = self.safe_value(response, 'data', [])
for i in range(0, len(data)):
balance = data[i]
currencyId = self.safe_string(balance, 'currency_id')
code = self.safe_currency_code(currencyId)
account = self.account()
account['total'] = self.safe_string(balance, 'total')
account['free'] = self.safe_string(balance, 'available')
# Local caching of bound methods
safe_value = self.safe_value
safe_string = self.safe_string
safe_currency_code = self.safe_currency_code
account_method = self.account

data = safe_value(response, 'data', [])
# Loop optimizations: hoist method lookup, reduce local dict lookups
for balance in data:
currencyId = safe_string(balance, 'currency_id')
code = safe_currency_code(currencyId)
account = account_method()
# Only two fields are accessed, assign directly for slight speedup
account['total'] = safe_string(balance, 'total')
account['free'] = safe_string(balance, 'available')
result[code] = account
return self.safe_balance(result)

Expand Down
Loading