
IoT開発、設備・DIYのブログ!
import nicehash | |
from zaifapi import ZaifPublicStreamApi | |
import time | |
import subprocess | |
import requests | |
import json | |
from zaifapi import ZaifPublicApi; | |
zaif = ZaifPublicApi(); | |
print(zaif.last_price("btc_jpy")); | |
json_str = json.dumps(zaif.last_price("btc_jpy")) | |
k = json.loads(json_str) | |
print(k['last_price']) | |
host = 'https://api2.nicehash.com' | |
organisation_id = '****' | |
key = '****' | |
secret = '****' | |
private_api = nicehash.private_api(host, organisation_id, key, secret) | |
my_accounts = private_api.get_accounts() | |
my_account2 = private_api.get_withdrawal_types() | |
print(my_accounts['total']['totalBalance']) | |
a = float(my_accounts['total']['totalBalance'])*k['last_price'] | |
print(int(a)) | |
def main(): | |
send_line_notify(my_accounts['total']['totalBalance'] + "BTC") | |
send_line_notify(str(a)+ "円") | |
def send_line_notify(notification_message): | |
line_notify_token ='*****' | |
line_notify_api = 'https://notify-api.line.me/api/notify' | |
headers = {'Authorization': f'Bearer {line_notify_token}'} | |
data = {'message': f'message: {notification_message}'} | |
requests.post(line_notify_api, headers = headers, data = data) | |
if __name__ == "__main__": | |
main() |