Get the balance of a particular token
        Returns {'balance': ...}
436916
def GET_account_balance(self, path_info, account_addr, token_type):
        
        if not check_account_address(account_addr):
            return self._reply_json({'error': 'Invalid address'}, status_code=400)

        if not check_token_type(token_type):
            return self._reply_json({'error': 'Invalid token type'}, status_code=400)

        blockstackd_url = get_blockstackd_url()
        res = blockstackd_client.get_account_balance(account_addr, token_type, hostport=blockstackd_url)
        if json_is_error(res):
            log.error("Failed to get account balance for {} {}: {}".format(account_addr, token_type, res['error']))
            return self._reply_json({'error': 'Failed to get balance of {} for {}: {}'.format(token_type, account_addr, res['error'])}, status_code=res.get('http_status', 500))

        self._reply_json({'balance': str(res)})     # NOTE: use a string, since this can be too big for js clients to parse
        return
767547
def getDebt(self):
        
        debt = float(self['principalBalance']) + float(self['interestBalance'])
        debt += float(self['feesBalance']) + float(self['penaltyBalance'])

        return debt
317487
def all_balances(currency, services=None, verbose=False, timeout=None):
    
    balances = {}
    if not services:
        services = [
            x(verbose=verbose, timeout=timeout)
            for x in ExchangeUniverse.get_authenticated_services()
        ]

    for e in services:
        try:
            balances[e] = e.get_exchange_balance(currency)
        except NotImplementedError:
            if verbose:
                print(e.name, "balance not implemented")
        except Exception as exc:
            if verbose:
                print(e.name, "failed:", exc.__class__.__name__, str(exc))

    return balances
1359630
def BalanceFor(self, assetId):
        
        for key, fixed8 in self.Balances.items():
            if key == assetId:
                return fixed8
        return Fixed8(0)
220098
def balance_get(self, nick):
        ''''''
        request = TOPRequest('xxxxx.xxxxx.account.balance.get')
        request['nick'] = nick
        self.create(self.execute(request))
        return self.result
81214
def get_instance(self, payload):
        
        return BalanceInstance(self._version, payload, account_sid=self._solution['account_sid'], )
1111514
function balance() {
	binance.balance((error, balances) => {
		if ( error ) console.error(error);
		let btc = 0.00;
		for ( let asset in balances ) {
			let obj = balances[asset];
			obj.available = parseFloat(obj.available);
			//if ( !obj.available ) continue;
			obj.onOrder = parseFloat(obj.onOrder);
			obj.btcValue = 0;
			obj.btcTotal = 0;
			if ( asset == 'BTC' ) obj.btcValue = obj.available;
			else if ( asset == 'USDT' ) obj.btcValue = obj.available / global.ticker.BTCUSDT;
			else obj.btcValue = obj.available * global.ticker[asset+'BTC'];
			if ( asset == 'BTC' ) obj.btcTotal = obj.available + obj.onOrder;
			else if ( asset == 'USDT' ) obj.btcTotal = (obj.available + obj.onOrder) / global.ticker.BTCUSDT;
			else obj.btcTotal = (obj.available + obj.onOrder) * global.ticker[asset+'BTC'];
			if ( isNaN(obj.btcValue) ) obj.btcValue = 0;
			if ( isNaN(obj.btcTotal) ) obj.btcTotal = 0;
			btc+= obj.btcTotal;
			global.balance[asset] = obj;
		}
		//fs.writeFile("json/balance.json", JSON.stringify(global.balance, null, 4), (err)=>{});
	});
}
1214538
def get_balance_on(self, on_date: datetime) -> Decimal:
        
        assert isinstance(on_date, datetime)

        total = Decimal(0)

        splits = self.get_splits_up_to(on_date)

        for split in splits:
            total += split.quantity * self.account.sign
        return total
10455
def look(self):
        """"""
        old_token = next(self)
        result = self.current
        self.push(result)
        self.current = old_token
        return result
293191
def get_token(self):
        
        token = None
        try:
            doc = self.doc_ref.get()
        except Exception as e:
            log.error('Token (collection: {}, doc_id: {}) '
                      'could not be retrieved from the backend: {}'
                      .format(self.collection, self.doc_id, str(e)))
            doc = None
        if doc and doc.exists:
            token_str = doc.get(self.field_name)
            if token_str:
                token = self.token_constructor(self.serializer.loads(token_str))
        self.token = token
        return token
801794
def get_balance(self, acc_id, site='Pro'):
        
        assert site in ['Pro', 'HADAX']
        path = f'/v1{"/" if site == "Pro" else "/hadax/"}account/accounts/{acc_id}/balance'
        # params = {'account-id': self.acct_id}
        params = {}

        def _wrapper(_func):
            @wraps(_func)
            def handle():
                _func(api_key_get(params, path))

            return handle

        return _wrapper
616356
def check_token(self):
        
        try:
            doc = self.doc_ref.get()
        except Exception as e:
            log.error('Token (collection: {}, doc_id: {}) '
                      'could not be retrieved from the backend: {}'
                      .format(self.collection, self.doc_id, str(e)))
            doc = None
        return doc and doc.exists
540019
def token(self):
        
        if not self._token:
            self._token = self.fetch_token()
            logger.payment(self)
        return self._token
432756
def params(self):
        
        params = {}
        params["access_token"] = self.access_token
        params["account_id"] = self.account_id
        return params
559498
def get_user_balance(self, username):
        
        cmd = ["gbalance", "-u", username, "--raw"]
        results = self._read_output(cmd)

        if len(results) == 0:
            return None

        return results
980087
def get_balance(self, acc_id=None, site='Pro', _async=False):
        
        acc_id = self.acc_id if acc_id is None else acc_id
        assert site in ['Pro', 'HADAX']
        path = f'/v1{"/" if site == "Pro" else "/hadax/"}account/accounts/{acc_id}/balance'
        # params = {'account-id': self.acct_id}
        params = {}
        return api_key_get(params, path, _async=_async)
644050
def token(self) -> str:
        

        return self.value[0] if self in (Role.USER, Role.ROLE_REMOVE) else self.name