def fetch_balance(self, params={}):
    self.load_markets()
    response = self.privateGetAccounts(params)
    result = {'info': response}
    balances = response['data']
    for i in range(0, len(balances)):
        balance = balances[i]
        currencyId = balance['asset_id']
        code = self.common_currency_code(currencyId)
        if (currencyId in self.currencies_by_id):
            code = self.currencies_by_id[currencyId]['code']
        total = self.safe_float(balance, 'balance')
        used = self.safe_float(balance, 'locked_balance')
        free = None
        if ((total is not None) and (used is not None)):
            free = (total - used)
        account = {'free': free, 'used': used, 'total': total}
        result[code] = account
    return self.parse_balance(result)
def fetch_balance(self, params={}):
    self.load_markets()
    response = self.privateGetAccounts(params)
    result = {'info': response}
    balances = response['data']
    for i in range(0, len(balances)):
        balance = balances[i]
        currencyId = balance['asset_id']
        code = self.common_currency_code(currencyId)
        if (currencyId in self.currencies_by_id):
            code = self.currencies_by_id[currencyId]['code']
        total = self.safe_float(balance, 'balance')
        used = self.safe_float(balance, 'locked_balance')
        free = None
        if ((total is not None) and (used is not None)):
            free = (total - used)
        account = {'free': free, 'used': used, 'total': total}
        result[code] = account
    return self.parse_balance(result)