def on_finish(self, timestmap): self.on_trading_finish(timestmap) # 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
def load_traders(): global traders global trader_names traders = get_trader_info(return_type="domain") account_readers.clear() order_readers.clear() for trader in traders: account_readers.append(AccountStatsReader(level=trader.level, trader_names=[trader.trader_name])) order_readers.append( OrderReader(start_timestamp=trader.start_timestamp, level=trader.level, trader_names=[trader.trader_name]) ) trader_names = [item.trader_name for item in traders]
def load_traders(region): global traders global trader_names traders = get_trader_info(region=region, return_type='domain') account_readers.clear() order_readers.clear() for trader in traders: account_readers.append( AccountStatsReader(region=region, trader_names=[trader.trader_name], level=trader.level)) order_readers.append( OrderReader(region=region, 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]