Пример #1
0
# organisation_id = 'Enter your organisation id'
# key = 'Enter your api key'
# secret = 'Enter your secret for api key'


# # Test - https://test.nicehash.com
# host = 'https://api-test.nicehash.com'
# organisation_id = '286fcf65-d44e-4cdf-81f2-4790c0cbed04'
# key = '6b957253-bcb9-4b83-b431-4f28ab783a6f'
# secret = 'ac09da0c-0b41-49ba-be6f-4698f9c184a67c6a834f-5bfe-5389-ba6f-d9ada9a86c03'

############################################
# PUBLIC FUNCTIONS

# Create public api object
public_api = nicehash.public_api(host, True)

# Get all algorithms
algorithms = public_api.get_algorithms()
print(algorithms)

# Get all markets
markets = public_api.get_markets()
print(markets)

# Get all curencies
currencies = public_api.get_currencies()
print(currencies)

# Get current global stats
global_stats_current = public_api.get_current_global_stats()
Пример #2
0
    return a + (b - a) * clamp(t, 0, 1)


def get_price():
    data = public_api.get_current_prices()
    return data["BTCUSDC"] * config.USD_EUR


def utc_to_local(utc):
    epoch = time.mktime(utc.timetuple())
    offset = datetime.fromtimestamp(epoch) - datetime.utcfromtimestamp(epoch)
    return utc + offset


# Create public api object
public_api = nicehash.public_api(False)

# Create public api object
private_api = nicehash.private_api(False)

if config.RUN_EMULATOR:
    imageEncoding = 'RGB'
else:
    imageEncoding = '1'
    # Raspberry Pi pin configuration:
    RST = None  # on the PiOLED this pin isnt used
    # Note the following are only used with SPI:
    DC = 24
    SPI_PORT = 0
    SPI_DEVICE = 0