def balance(request): """ .. http:post:: /management/balance/ **Request**: .. sourcecode:: json **Response**: .. sourcecode:: json [{ "type":"deposit", "currency":"btc", "amount":"0.0", "available":"0.0" },{ "type":"deposit", "currency":"usd", "amount":"1.0", "available":"1.0" }, ...] """ r = post_balances() return json_response(r)
def get_balance(currency, low_limit): available = 0.0 b = bitfinex_client.post_balances(show_console=True) for w in b: if (w["type"] == "exchange") and (w["currency"] == currency.lower()): available = float(w["available"]) break if available < low_limit: available = 0.0 return available
def get_balance(): USD_wallet = 0.0 BTC_wallet = 0.0 b = bitfinex_client.post_balances(show_console=True) for w in b: if (w["type"] == "exchange") and (w["currency"] == pair[3:].lower()): USD_wallet = float(w["available"]) if (w["type"] == "exchange") and (w["currency"] == pair[:3].lower()): BTC_wallet = float(w["available"]) low_limit = 0.000001 if USD_wallet < low_limit: USD_wallet = 0.0 if BTC_wallet < low_limit: BTC_wallet = 0.0 return USD_wallet, BTC_wallet