From 818fa062abe1d456b1e028314821b108ec8e074e Mon Sep 17 00:00:00 2001 From: m1 Date: Sat, 2 Sep 2017 13:12:22 -0700 Subject: [PATCH] include daily profit estimates in algo-log (in BTC and local currency) --- conf.json | 2 +- switch.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conf.json b/conf.json index e65365d..a2eddb5 100644 --- a/conf.json +++ b/conf.json @@ -1,6 +1,6 @@ { "currency": "USD", - "pwrcost": 0.12, + "pwrcost": 0.107, "min_profit": 0.0, "payment_addr": "1TipsGocnz2N5qgAm9f7JLrsMqkb3oXe2", "miner_name": "MyMiner", diff --git a/switch.py b/switch.py index a9e49b2..ec193fb 100644 --- a/switch.py +++ b/switch.py @@ -1,6 +1,6 @@ #!/usr/bin/env python2.7 -import urllib +import urllib2 import json import subprocess import time @@ -36,8 +36,8 @@ for algo in performance: performance[algo]["cmd"]=performance[algo]["cmd"].format(ADDR=payment_addr, MINER=miner_name) # fetch data from public APIs -exchrate=float(json.loads(urllib.urlopen("https://api.coinbase.com/v2/exchange-rates?currency=BTC").read())["data"]["rates"][currency]) -rawrev=json.loads(urllib.urlopen("https://api.nicehash.com/api?method=simplemultialgo.info").read())["result"]["simplemultialgo"] +exchrate=float(json.loads(urllib2.urlopen("https://api.coinbase.com/v2/exchange-rates?currency=BTC").read())["data"]["rates"][currency]) +rawrev=json.loads(urllib2.urlopen("https://api.nicehash.com/api?method=simplemultialgo.info").read())["result"]["simplemultialgo"] # calculate our profitability profit={} @@ -83,7 +83,7 @@ if (current==0): if (current==0): # log a change algo_log=open("algo-log", "a") - algo_log.write(str(datetime.datetime.now())+": "+max_profit_algo+"\n") + algo_log.write(str(datetime.datetime.now())+": "+max_profit_algo+" (*) "+format(max_profit_val, ".8f")+" "+format(max_profit_val*exchrate, ".2f")+"\n") algo_log.close() if (other==1): # kill existing miners