forked from ccyanxyz/cycle-arb-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
draw_profit_rev_distribution.py
55 lines (47 loc) · 1.23 KB
/
draw_profit_rev_distribution.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
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import json
stats = json.load(open('data/profit_revenue_cost.json'))
profits = [t/1e18 for t in stats['profits']]
revenues = [t/1e18 for t in stats['revenues']]
costs = [t/1e18 for t in stats['costs']]
print('len:', len(profits))
# count = 0
# for t in profits:
# if t >= -0.1 and t <= 0.7:
# count += 1
# print(count)
bins = []
start = -0.1
while start < 0.4:
bins.append(start)
start += 0.01
bins = np.array(bins)
# profit distribution
plt.hist(profits, bins, color='b', alpha=0.5, label='profit')
plt.xlabel('Amount(ETH)')
plt.ylabel('Number of Arbitrage Txs')
plt.legend()
plt.savefig('reports/profit_dist.png')
plt.clf()
# revenue distribution
plt.hist(revenues, bins, color='r', alpha=0.5, label='revenue')
plt.xlabel('Amount(ETH)')
plt.ylabel('Number of Arbitrage Txs')
plt.legend()
plt.savefig('reports/revenue_dist.png')
plt.clf()
bins = []
start = 0
while start < 0.3:
bins.append(start)
start += 0.01
bins = np.array(bins)
# cost distribution
plt.hist(costs, bins, color='g', alpha=0.5, label='cost')
plt.xlabel('Amount(ETH)')
plt.ylabel('Number of Arbitrage Txs')
plt.legend()
plt.savefig('reports/cost_dist.png')