-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmining_strategy.py
81 lines (74 loc) · 2.67 KB
/
mining_strategy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from eobot_api.coins import get_coins
from eobot_api.user import set_config
from config.real_config import USER_ID, EMAIL, PASSWORD
from eobot_api.mining import change_mining_mode, get_mode, get_monthly_revenue
from eobot_api.exchange import get_amount, exchange
from eobot_api.user import get_balance
import httpx
import json
import datetime
from time import sleep
# Configure user
set_config(USER_ID, EMAIL, PASSWORD)
# estimate ghs gain
# old_monthly_revenue = get_monthly_revenue()
# old_hourly_revenue = old_monthly_revenue['Cloud2SHA-256'] / 732
# old_estimate_ghs = get_amount("USD", "GHS5", old_hourly_revenue)
# mining speed
# mining_speed = get_mining_speed()
# print(mining_speed)
# coins supported
coins_supported = get_coins()
coins_supported.remove("CURE")
coins_supported.remove("STEEM")
coins_supported.remove("TRX")
coins_supported.remove('XEM')
# test
RUN = True
while RUN:
# coins profit
r = httpx.get("https://whattomine.com/calculators.json")
coins = json.loads(r.text)
coins_dict = coins["coins"]
coins_stats = {}
for key, value in coins_dict.items():
if value["tag"] in coins_supported:
coins_stats[key] = value
coins_profit = {}
for key, value in coins_stats.items():
r = httpx.get(
"https://whattomine.com/coins/" + str(value["id"]) + ".json")
stat = json.loads(r.text)
coins_profit[value["tag"]] = float(stat['profit'].replace("$", ""))
# mine the more profitable coin
more_profitable_coin = max(coins_profit, key=coins_profit.get)
change_mining_mode(more_profitable_coin)
now = datetime.datetime.now()
print(coins_profit)
print(
now.strftime("%H:%M:%S"),
" More profitable coin: ", more_profitable_coin,
" - Mining mode: ", get_mode())
sleep(600)
amount = get_balance(more_profitable_coin) / 2
exchange(more_profitable_coin, amount)
now = datetime.datetime.now()
print(
now.strftime("%H:%M:%S"),
" Exchange ", amount, " ", more_profitable_coin)
# estimate ghs gain
# new_monthly_revenue = get_monthly_revenue()
# new_hourly_revenue = new_monthly_revenue['Cloud2SHA-256'] / 732
# new_estimate_ghs = get_amount("USD", "GHS5", new_hourly_revenue)
# change_mining_mode("GHS5")
# estimate_ghs_with_coin = 0.95 * get_amount(
# more_profitable_coin, "GHS5", get_balance(more_profitable_coin))
# print(
# "Before: hourly revenue -> $", old_hourly_revenue,
# " estimate_ghs -> ", old_estimate_ghs, " GHS5")
# print(
# "After: hourly revenue -> $", new_hourly_revenue,
# " estimate_ghs -> ", new_estimate_ghs, " GHS5")
# print(
# "Estimate with ", more_profitable_coin, " -> ",
# estimate_ghs_with_coin, " GHS5")