github.com/pdaian/flashboys2@v0.0.0-20190718175736-b101c35361f0/count_wins.py (about) 1 import csv 2 def get_winner_dict(): 3 winner_dict = {} 4 slotsdict = csv.DictReader(open('data/slot_auction.csv')) 5 for slot in slotsdict: 6 slot['log_count'] = slot['log_addrs'].count("~") + min(1, len(slot['log_addrs'])) 7 winner_dict[slot['hash']] = slot 8 return winner_dict 9 10 11 arbs = {} 12 13 winner_dict = get_winner_dict() 14 print(len(winner_dict.keys())) 15 16 for hash in winner_dict: 17 if winner_dict[hash]['log_count'] > 0: 18 sender = winner_dict[hash]['from'] 19 if not sender in arbs: 20 arbs[sender] = 0 21 arbs[sender] += 1 22 23 print(arbs)