MCPcopy Create free account
hub / github.com/ccxt/ccxt / parse_margin_balance

Method parse_margin_balance

python/ccxt/async_support/ascendex.py:933–950  ·  view source on GitHub ↗
(self, response)

Source from the content-addressed store, hash-verified

931 return self.safe_balance(result)
932
933 def parse_margin_balance(self, response):
934 result = {
935 'info': response,
936 'timestamp': None,
937 'datetime': None,
938 }
939 balances = self.safe_list(response, 'data', [])
940 for i in range(0, len(balances)):
941 balance = balances[i]
942 code = self.safe_currency_code(self.safe_string(balance, 'asset'))
943 account = self.account()
944 account['free'] = self.safe_string(balance, 'availableBalance')
945 account['total'] = self.safe_string(balance, 'totalBalance')
946 debt = self.safe_string(balance, 'borrowed')
947 interest = self.safe_string(balance, 'interest')
948 account['debt'] = Precise.string_add(debt, interest)
949 result[code] = account
950 return self.safe_balance(result)
951
952 def parse_swap_balance(self, response):
953 result = {

Callers 1

fetch_balanceMethod · 0.95

Calls 7

safe_listMethod · 0.80
safe_stringMethod · 0.80
string_addMethod · 0.80
safe_balanceMethod · 0.80
rangeFunction · 0.50
safe_currency_codeMethod · 0.45
accountMethod · 0.45

Tested by

no test coverage detected