minermedic/miners/helper.py
def calculate_hashrates(results, miner, hashrate_ghs5s, algo):

    """
    Calculates Hashrates for a miner based on the Algo and a passed Hashrate in GH/s.
    Stores values in the Miner Results Object.

    Returns:
        None

    """

    # first get the hashrate info for this ALGO on this MODEL miner
    hashrate_info = get_hashrate_info(results, miner, algo)

    if hashrate_info is None:
        return

    # get the current hashrate and units, normalized to what this device and algo are set to in the model
    current_hashrate, hashrate_units = \
        get_normalized_hashrate_from_gigahash_per_sec(hashrate_ghs5s, hashrate_info['units'])

    # get the expected hashrate
    expected_hashrate = hashrate_info['expected_rate']

    # if zero, set it to the rate...
    if expected_hashrate == 0:
        expected_hashrate = miner.hashrate[0]['rate']

    # update all detailed hashrate stats for this miner
    results.set_result(miner, 'hashrates', {'current': current_hashrate, 'max': expected_hashrate,
                                            'units': hashrate_units, 'algo': algo})

    try:

        # update the normalized hashrate results using the global hashrate
        datamodel_hashrate, calculated_units = \
            get_normalized_hashrate_from_gigahash_per_sec(hashrate_ghs5s, get_normalized_global_hashrate())

        units_id = get_units_id_by_symbol(calculated_units)

        # set the normalized result
        results.set_result(miner, 'hashrate', datamodel_hashrate)
        results.set_result(miner, 'hashrate_units', units_id)

    except:
        pass

    # FOR HASHRATE PER MODEL -->

    # add in the total hash_rate_per_model
    hashrate_info["sum_current"] += current_hashrate

    # set the units
    hashrate_info["unit"] = hashrate_units

    # add max for this model
    hashrate_info["sum_max"] += expected_hashrate

    # TODO - ACCEPTED HASHRATE PER ALGO / POOL

    Calculates Hashrates for a miner based on the Algo and a passed Hashrate in GH/s.
    Stores values in the Miner Results Object.

    Returns:
        None

    
Calculates Hashrates for a miner based on the Algo and a passed Hashrate in GH/s.
Stores values in the Miner Results Object.
Calculates Hashrates for a miner based on the Algo and a passed Hashrate in GH / s . Stores values in the Miner Results Object .
def calculate_hashrates(results, miner, hashrate_ghs5s, algo):
    hashrate_info = get_hashrate_info(results, miner, algo)
    if hashrate_info is None:
        return
    current_hashrate, hashrate_units = \
        get_normalized_hashrate_from_gigahash_per_sec(hashrate_ghs5s, hashrate_info['units'])
    expected_hashrate = hashrate_info['expected_rate']
    if expected_hashrate == 0:
        expected_hashrate = miner.hashrate[0]['rate']
    results.set_result(miner, 'hashrates', {'current': current_hashrate, 'max': expected_hashrate,
                                            'units': hashrate_units, 'algo': algo})
    try:
        datamodel_hashrate, calculated_units = \
            get_normalized_hashrate_from_gigahash_per_sec(hashrate_ghs5s, get_normalized_global_hashrate())
        units_id = get_units_id_by_symbol(calculated_units)
        results.set_result(miner, 'hashrate', datamodel_hashrate)
        results.set_result(miner, 'hashrate_units', units_id)
    except:
        pass
    hashrate_info["sum_current"] += current_hashrate
    hashrate_info["unit"] = hashrate_units
    hashrate_info["sum_max"] += expected_hashrate
def calculate_hashrates ( results , miner , hashrate_ghs5s , algo ) : hashrate_info = get_hashrate_info ( results , miner , algo ) if hashrate_info is None : return current_hashrate , hashrate_units = get_normalized_hashrate_from_gigahash_per_sec ( hashrate_ghs5s , hashrate_info [ 'units' ] ) expected_hashrate = hashrate_info [ 'expected_rate' ] if expected_hashrate == 0 : expected_hashrate = miner . hashrate [ 0 ] [ 'rate' ] results . set_result ( miner , 'hashrates' , { 'current' : current_hashrate , 'max' : expected_hashrate , 'units' : hashrate_units , 'algo' : algo } ) try : datamodel_hashrate , calculated_units = get_normalized_hashrate_from_gigahash_per_sec ( hashrate_ghs5s , get_normalized_global_hashrate ( ) ) units_id = get_units_id_by_symbol ( calculated_units ) results . set_result ( miner , 'hashrate' , datamodel_hashrate ) results . set_result ( miner , 'hashrate_units' , units_id ) except : pass hashrate_info [ "sum_current" ] += current_hashrate hashrate_info [ "unit" ] = hashrate_units hashrate_info [ "sum_max" ] += expected_hashrate
Calculates Hashrates for a miner based on the Algo and a passed Hashrate in GH/s.
Calculates Hashrates for a miner based on the Algo and a passed Hashrate in GH / s .
"""
    Calculates Hashrates for a miner based on the Algo and a passed Hashrate in GH/s.
    Stores values in the Miner Results Object.

    Returns:
        None

    """ # first get the hashrate info for this ALGO on this MODEL miner # get the current hashrate and units, normalized to what this device and algo are set to in the model # get the expected hashrate # if zero, set it to the rate... # update all detailed hashrate stats for this miner # update the normalized hashrate results using the global hashrate # set the normalized result # FOR HASHRATE PER MODEL --> # add in the total hash_rate_per_model # set the units # add max for this model # TODO - ACCEPTED HASHRATE PER ALGO / POOL
None
results
miner
hashrate_ghs5s
algo