def get_stock_signal_data():
fname = os.path.join(os.getcwd(), 'data', 'stock_data', '_IF000.csv')
price_data = csv2frame(fname)
from matplotlib.colors import colorConverter
info = load_tradeinfo("_djtrend2_IF000")
entry_x = []
entry_y = info['entry_price'].tolist()
exit_x = []
exit_y = info['exit_price'].tolist()
colors = []
for t in info.index:
entry_x.append(price_data.index.searchsorted(t))
for t in info['exit_datetime'].values:
exit_x.append(price_data.index.searchsorted(t))
for i in range(len(info)):
tr = info.ix[i]
if tr['islong']:
c = 'r' if tr['exit_price']>tr['entry_price'] else 'w'
else:
c = 'r' if tr['exit_price']<tr['entry_price'] else 'w'
r,g,b = colorConverter.to_rgb(c)
colors.append((r,g,b,1))
return price_data, entry_x, entry_y, exit_x, exit_y, colors
评论列表
文章目录