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

Method parse_margin_balance

python/ccxt/ascendex.py:932–949  ·  view source on GitHub ↗
(self, response)

Source from the content-addressed store, hash-verified

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