Example #1
0
 def on_finish(self):
     # show the result
     if self.draw_result:
         import plotly.io as pio
         pio.renderers.default = "browser"
         reader = AccountStatsReader(trader_names=[self.trader_name])
         df = reader.data_df
         drawer = Drawer(main_data=NormalData(df.copy()[['trader_name', 'timestamp', 'all_value']],
                                              category_field='trader_name'))
         drawer.draw_line(show=True)
def get_account_stats_figure(account_stats_reader: AccountStatsReader):
    graph_list = []

    # 账户统计曲线
    if account_stats_reader:
        fig = account_stats_reader.draw_line(show=False)

        for trader_name in account_stats_reader.trader_names:
            graph_list.append(
                dcc.Graph(id='{}-account'.format(trader_name), figure=fig))

    return graph_list
Example #3
0
def load_traders():
    global traders
    global trader_names

    traders = get_trader_info(return_type='domain')
    for trader in traders:
        account_readers.append(
            AccountStatsReader(trader_names=[trader.trader_name],
                               level=trader.level))
        order_readers.append(
            OrderReader(trader_names=[trader.trader_name],
                        level=trader.level,
                        start_timestamp=trader.start_timestamp,
                        end_timestamp=trader.end_timestamp))

    trader_names = [item.trader_name for item in traders]