Пример #1
0
    def call_unitroot(self, other_args: List[str]):
        """Process unitroot command"""
        parser = argparse.ArgumentParser(
            add_help=False,
            formatter_class=argparse.ArgumentDefaultsHelpFormatter,
            prog="unitroot",
            description="""
                Unit root test / stationarity (ADF, KPSS)
            """,
        )
        parser.add_argument(
            "-r",
            "--fuller_reg",
            help="Type of regression.  Can be ‘c’,’ct’,’ctt’,’nc’ 'c' - Constant and t - trend order",
            choices=["c", "ct", "ctt", "nc"],
            default="c",
            type=str,
            dest="fuller_reg",
        )
        parser.add_argument(
            "-k",
            "--kps_reg",
            help="Type of regression.  Can be ‘c’,’ct'",
            choices=["c", "ct"],
            type=str,
            dest="kpss_reg",
            default="c",
        )
        parser.add_argument(
            "--export",
            choices=["csv", "json", "xlsx"],
            default="",
            type=str,
            dest="export",
            help="Export dataframe data to csv,json,xlsx file",
        )

        try:
            ns_parser = parse_known_args_and_warn(parser, other_args)
            if not ns_parser:
                return

            qa_view.display_unitroot(
                df=self.stock,
                target=self.target,
                fuller_reg=ns_parser.fuller_reg,
                kpss_reg=ns_parser.kpss_reg,
                export=ns_parser.export,
            )

        except Exception as e:
            print(e, "\n")
Пример #2
0
 def call_unitroot(self, other_args: List[str]):
     """Process unitroot command"""
     parser = argparse.ArgumentParser(
         add_help=False,
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
         prog="unitroot",
         description="""
             Unit root test / stationarity (ADF, KPSS)
         """,
     )
     parser.add_argument(
         "-r",
         "--fuller_reg",
         help=
         "Type of regression.  Can be ‘c’,’ct’,’ctt’,’nc’ 'c' - Constant and t - trend order",
         choices=["c", "ct", "ctt", "nc"],
         default="c",
         type=str,
         dest="fuller_reg",
     )
     parser.add_argument(
         "-k",
         "--kps_reg",
         help="Type of regression.  Can be ‘c’,’ct'",
         choices=["c", "ct"],
         type=str,
         dest="kpss_reg",
         default="c",
     )
     ns_parser = parse_known_args_and_warn(
         parser, other_args, export_allowed=EXPORT_ONLY_RAW_DATA_ALLOWED)
     if ns_parser:
         qa_view.display_unitroot(
             df=self.df,
             target=self.target,
             fuller_reg=ns_parser.fuller_reg,
             kpss_reg=ns_parser.kpss_reg,
             export=ns_parser.export,
         )