-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_sp500_data.py
54 lines (39 loc) · 1002 Bytes
/
test_sp500_data.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
import numpy as np
from sp500_data_loader import load_data
import matplotlib.pyplot as plt
from scipy.stats import norm
start_date = '2010-01-01'
end_date = '2017-12-12'
df_open, df_close, df_high, df_low, df_adj_close = load_data(['MMM', 'AMZN'], start_date, end_date)
# desc = df_open.describe()
# print(desc.loc['mean']['AMZN'])
# print(desc.loc['std']['AMZN'])
# changes = np.abs(df_close - df_open) / df_open * 100.
# plt.plot(norm.pdf(df_open.index,desc.loc['mean']['AMZN'],desc.loc['std']['AMZN']))
# plt.plot(changes)
# for i in df_open.index:
# print(i)
plt.title('open')
plt.plot(df_open)
plt.legend(df_open.keys())
plt.show()
plt.clf()
plt.title('close')
plt.plot(df_close)
plt.legend(df_open.keys())
plt.show()
plt.clf()
plt.title('adj_close')
plt.plot(df_adj_close)
plt.legend(df_open.keys())
plt.show()
plt.clf()
plt.title('high')
plt.plot(df_high)
plt.legend(df_open.keys())
plt.show()
plt.clf()
plt.title('low')
plt.plot(df_low)
plt.legend(df_open.keys())
plt.show()