-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay_actions.py
48 lines (33 loc) · 1001 Bytes
/
display_actions.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
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from multiprocessing import Pool
data = pd.read_csv("coinbaseUSD_1D.csv")
x = data['Timestamp']
y = data['Close']
def diplay_graphs(x, y, nb):
h = ['Close', 'Action']
for i in range(nb):
data2 = pd.read_csv("saves/log_actions_" + str(i) + ".csv", names=h)
actions = data2['Action']
xBuy = []
yBuy = []
for i in range(len(actions)):
if actions[i] == 'BUY':
xBuy.append(x[i])
yBuy.append(10000)
xSell = []
ySell = []
for i in range(len(actions)):
if actions[i] == 'SELL':
xSell.append(x[i])
ySell.append(10000)
plt.figure()
plt.plot(x,y)
green = (0, 1, 0, 0.5)
red = (1, 0, 0, 0.5)
plt.bar(xBuy, yBuy, color=green)
plt.bar(xSell, ySell, color=red)
plt.xticks([])
plt.show()
diplay_graphs(x, y, 5)