예제 #1
0
    def draw(self,
             render='html',
             file_name=None,
             width=None,
             height=None,
             title=None,
             keep_ui_state=True,
             annotation_df=None,
             target_type: TargetType = TargetType.open_long):

        if target_type == TargetType.open_long:
            df = self.open_long_df.copy()
        elif target_type == TargetType.open_short:
            df = self.open_short_df.copy()

        df['target_type'] = target_type.value

        if pd_is_not_null(df):
            df = df.reset_index(drop=False)
            drawer = Drawer(df)

            drawer.draw_table(width=width,
                              height=height,
                              title=title,
                              keep_ui_state=keep_ui_state)
예제 #2
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()