Esempio n. 1
0
 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)
Esempio n. 2
0
 def draw_line(self, show=True):
     drawer = Drawer(
         main_data=NormalData(
             self.data_df.copy()[["trader_name", "timestamp", "all_value"]], category_field="trader_name"
         )
     )
     return drawer.draw_line(show=show)
Esempio n. 3
0
    def draw_result(self, entity_id):
        if self.label_method == "raw":
            df = self.kdata_df.loc[[entity_id], ["close"]].copy()

            pred_df = self.pred_y.to_frame(name="pred_close")
            pred_df = pred_df.loc[[entity_id], :].shift(self.predict_steps)

            drawer = Drawer(
                main_df=df,
                factor_df_list=[pred_df],
            )
            drawer.draw_line(show=True)
        else:
            pred_df = self.pred_y.to_frame(name="pred_result").loc[[entity_id], :]
            df = self.testing_y.to_frame(name="real_result").loc[[entity_id], :].join(pred_df, how="outer")

            drawer = Drawer(main_df=df)
            drawer.draw_table()
Esempio n. 4
0
 def draw_line(self, show=True):
     drawer = Drawer(main_data=NormalData(
         self.data_df.copy()[['trader_name', 'timestamp', 'all_value']],
         category_field='trader_name'))
     return drawer.draw_line(show=show)
Esempio n. 5
0
                self.filters = filter

        super().__init__(Order,
                         None,
                         None,
                         None,
                         None,
                         None,
                         None,
                         the_timestamp,
                         start_timestamp,
                         end_timestamp,
                         columns,
                         self.filters,
                         order,
                         None,
                         level,
                         category_field='trader_name',
                         time_field='timestamp',
                         computing_window=None)


if __name__ == '__main__':
    reader = AccountStatsReader(trader_names=['000338_ma_trader'])
    drawer = Drawer(main_data=NormalData(
        reader.data_df.copy()[['trader_name', 'timestamp', 'all_value']],
        category_field='trader_name'))
    drawer.draw_line()
# the __all__ is generated
__all__ = ['AccountStatsReader', 'OrderReader']