-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.py
33 lines (26 loc) · 939 Bytes
/
stats.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
from explorer import Explorer
from statistics import mean, median, mode, pstdev, StatisticsError
import pickle
from tqdm import tqdm
def get_summary_stats(values):
summary = {}
summary['min'] = min(values)
summary['max'] = max(values)
summary['mean'] = round(mean(values))
summary['median'] = round(median(values))
summary['stdev'] = round(pstdev(values), 2)
try:
summary['mode'] = mode(values)
except StatisticsError: # There is not exactly one most common value
summary['mode'] = -1
return summary
if __name__ == '__main__':
stats = []
explorer = Explorer()
with open('WasabiCoinJoins.txt', 'r') as f:
txids = [line.strip() for line in f]
for txid in tqdm(txids):
input_values = explorer.amounts_from_txid(txid)
stats.append(get_summary_stats(input_values))
with open('wasabi_cj_stats.pkl', 'wb') as f:
pickle.dump(stats, f)