SMABOT.py
def convert_volume():
    '''Converts the volume in free 'Pair_with' to the coin's volume'''

    volatile_coins, number_of_coins, last_price = wait_for_price()
    lot_size = {}
    volume = {}

    for coin in volatile_coins:

        # Find the correct step size for each coin
        # max accuracy for BTC for example is 6 decimal points, while XRP just 1.
        try:
            info = client.get_symbol_info(coin)
            step_size = info['filters'][2]['stepSize']
            lot_size[coin] = step_size.index('1') - 1
            
            if lot_size[coin] < 0:
                lot_size[coin] = 0
    
            
        except:
            pass
        # new code x% of free balance
        free_balance = client.get_asset_balance(asset='BUSD')
        free = math.floor(float(free_balance['free']) * 1)
        # calculate the volume in coin from QUANTITY in 'PAIRWITH' (default)
        volume[coin] = float(free / float(last_price[coin]['price']))
        
      
        # define the volume with the correct step size
        if coin not in lot_size:
            volume[coin] = float('{:.1f}'.format(volume[coin]))

        else:
            # if lot size has 0 decimal points, make the volume an integer
            if lot_size[coin] == 0:
                volume[coin] = int(volume[coin])
            else:
                volume[coin] = float('{:.{}f}'.format(volume[coin], lot_size[coin]))

    return volume, last_price
Converts the volume in free 'Pair_with' to the coin's volume
Converts the volume in free 'Pair_with' to the coin's volume
Converts the volume in free ' Pair_with ' to the coin ' s volume
def convert_volume():
    volatile_coins, number_of_coins, last_price = wait_for_price()
    lot_size = {}
    volume = {}
    for coin in volatile_coins:
        try:
            info = client.get_symbol_info(coin)
            step_size = info['filters'][2]['stepSize']
            lot_size[coin] = step_size.index('1') - 1
            if lot_size[coin] < 0:
                lot_size[coin] = 0
        except:
            pass
        free_balance = client.get_asset_balance(asset='BUSD')
        free = math.floor(float(free_balance['free']) * 1)
        volume[coin] = float(free / float(last_price[coin]['price']))
        if coin not in lot_size:
            volume[coin] = float('{:.1f}'.format(volume[coin]))
        else:
            if lot_size[coin] == 0:
                volume[coin] = int(volume[coin])
            else:
                volume[coin] = float('{:.{}f}'.format(volume[coin], lot_size[coin]))
    return volume, last_price
def convert_volume ( ) : volatile_coins , number_of_coins , last_price = wait_for_price ( ) lot_size = { } volume = { } for coin in volatile_coins : try : info = client . get_symbol_info ( coin ) step_size = info [ 'filters' ] [ 2 ] [ 'stepSize' ] lot_size [ coin ] = step_size . index ( '1' ) - 1 if lot_size [ coin ] < 0 : lot_size [ coin ] = 0 except : pass free_balance = client . get_asset_balance ( asset = 'BUSD' ) free = math . floor ( float ( free_balance [ 'free' ] ) * 1 ) volume [ coin ] = float ( free / float ( last_price [ coin ] [ 'price' ] ) ) if coin not in lot_size : volume [ coin ] = float ( '{:.1f}' . format ( volume [ coin ] ) ) else : if lot_size [ coin ] == 0 : volume [ coin ] = int ( volume [ coin ] ) else : volume [ coin ] = float ( '{:.{}f}' . format ( volume [ coin ] , lot_size [ coin ] ) ) return volume , last_price
Converts the volume in free 'Pair_with' to the coin's volume
Converts the volume in free ' Pair_with ' to the coin ' s volume
'''Converts the volume in free 'Pair_with' to the coin's volume''' # Find the correct step size for each coin # max accuracy for BTC for example is 6 decimal points, while XRP just 1. # new code x% of free balance # calculate the volume in coin from QUANTITY in 'PAIRWITH' (default) # define the volume with the correct step size # if lot size has 0 decimal points, make the volume an integer