Exemplo n.º 1
0
def get_allocated_pair_balances(exchange, base, coin):
    allocated_pair_balances = {'base': 0, 'coin': 0}

    merkatos = get_merkatos_by_exchange(exchange)
    for merkato in merkatos:
        if merkato['base'] == base:
            allocated_pair_balances['base'] += merkato['bid_reserved_balance']

        if merkato['alt'] == coin:
            allocated_pair_balances['coin'] += merkato['ask_reserved_balance']
    return allocated_pair_balances
Exemplo n.º 2
0
def get_allocated_pair_balances(exchange, base, coin):
    allocated_pair_balances = {
        'base': Decimal(0),
        'coin': Decimal(0)
    }

    merkatos = get_merkatos_by_exchange(exchange)
    for merkato in merkatos:
        if merkato['base'] == base:
            allocated_pair_balances['base'] += Decimal(merkato['bid_reserved_balance'])
            allocated_pair_balances['base'] += Decimal(merkato['base_partials_balance'])

        if merkato['alt'] == coin:
            allocated_pair_balances['coin'] += Decimal(merkato['ask_reserved_balance'])
            allocated_pair_balances['coin'] += Decimal(merkato['quote_partials_balance'])

    return allocated_pair_balances