def generate(df, flg, stockCode, stockName, is_gen_single): Y_AXIS_NAMES = ['收盘价', '温度'] if flg is 'stock_A': Y_AXIS_NAMES = ['前复权', '温度'] dates = df['date'] y_axises2 = [] y_axises2.append(df['absolute_temp']) y_axises2.append(df['relative_temp']) decimal = 3 y_axises2.append(df['avg_temp'].round(decimals=decimal)) y_axises2.append(df['pb'].round(decimals=decimal)) y_axises2.append(df['pe'].round(decimals=decimal)) y_axises2.append(df['roe'].round(decimals=decimal)) y_axises2.append(df['s'].round(decimals=decimal)) y_axises2.append(df['guozhai'].round(decimals=decimal)) y_axises = df["cp"] line = Line(width=1200, title=stockName) option = option_process(stockCode, stockName, CHART_NAMES, dates, y_axises, y_axises2, Y_AXIS_NAMES) # line.render('output/temp_line.html') # line._option = getOption() file = 'output/abs_temp_line_' + flg + '_' + stockCode + '.html' line._option = option if is_gen_single is True: line.render(path=file, template_name='template/temp_history.html', object_name='line') return line
def generate(df, flg, stockCode, stockName): dates = df['date'] y_axises = [] y_axises.append(df['shouyi']) y_axises.append(df['g_roe']) y_axises2 = df["bp"] line = Line(width=1200) option = option_process(stockCode, stockName, CHART_NAMES, dates, y_axises, y_axises2) # line.render('output/temp_line.html') # line._option = getOption() file = 'output/niuxiong_line_' + flg + '_' + stockCode + '.html' line._option = option line.render(path=file, template_name='template/temp_history2.html', object_name='line')
def generate(): df = pd.read_csv('data/temp_history.csv') df = df.sort_index(ascending=False) dates = df[STOCK_NAMES[0]] names = STOCK_NAMES[1:] y_axises = [] for name in names: y_axises.append(df[name]) y_axises2 = df["中证全指指数"] line = Line(width=1200) option = option_process(CHART_NAMES, dates, y_axises, y_axises2) # line.render('output/temp_line.html') # line._option = getOption() file = 'output/temp_line.html' line._option = option line.render(path=file, template_name='template/temp_history.html', object_name='line')