Last active
January 17, 2019 07:50
-
-
Save HAOYUatHZ/bf2242ee830d3293eb4910fb686d8473 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# grep -o -E 'MinerName=.* +diff=[0-9]+' copy.log > all_stats.log | |
filename = "all_stats.log" | |
all_earn = 453.259264136 | |
from collections import defaultdict | |
d = {} | |
d = defaultdict(lambda: 0, d) | |
diff_sum = 0 | |
fee = 0.97 | |
with open(filename) as file: | |
for line in file: | |
line = " ".join(line.replace("MinerName=", "").replace("diff=", "").split()) | |
parts = line.split(" ") | |
user = parts[0] | |
diff = int(parts[1]) | |
d[user] = d[user]+diff | |
diff_sum = diff_sum + diff | |
print "all_earn", all_earn | |
print "diff_sum", diff_sum | |
print "" | |
for user in d: | |
weight = d[user]*1.0/diff_sum | |
print "percent:%f\tearn:%f\tpay:%f\tuser:%s" % (weight, weight*all_earn, weight*all_earn*fee, user) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment