forked from tianjixuetu/PyTrading
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotter.py
More file actions
23 lines (21 loc) · 770 Bytes
/
plotter.py
File metadata and controls
23 lines (21 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import matplotlib.pyplot as plt
import webbrowser
def plot_close(title = 'Stock Prices per Minute'):
# df1 = df.ix[0:,'CLOSE']
# ax = df1.plot(title=title, fontsize=10)
# ax.set_xlabel('DATE')
# ax.set_ylabel('CLOSE')
# plt.show()
url="https://www.google.com/finance?q=NSE%3A"
chrome_path = 'open -a /Applications/Google\ Chrome.app %s'
webbrowser.get(chrome_path).open(url+title)
def plot_change_hist(df):
ax=df['Percent Change'].hist(bins=100)
mean = df['Percent Change'].mean()
std = df['Percent Change'].std()
ax.set_xlabel('CHANGE')
ax.set_ylabel('FREQUENCY')
plt.axvline(mean,color='g',linestyle='dashed',linewidth=2)
plt.axvline(std,color='r',linestyle='dashed',linewidth=2)
plt.axvline(-std,color='r',linestyle='dashed',linewidth=2)
plt.show()