Exemplo n.º 1
0
 def call_fipo(self, other_args: List[str]):
     """Process fipo command"""
     parser = argparse.ArgumentParser(
         add_help=False,
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
         prog="fipo",
         description="""
             Future IPOs dates. [Source: https://finnhub.io]
         """,
     )
     parser.add_argument(
         "-l",
         "--limit",
         action="store",
         dest="limit",
         type=check_non_negative,
         default=5,
         help="Limit of future days to look for IPOs.",
     )
     if other_args and "-" not in other_args[0][0]:
         other_args.insert(0, "-l")
     ns_parser = parse_known_args_and_warn(parser, other_args,
                                           EXPORT_ONLY_RAW_DATA_ALLOWED)
     if ns_parser:
         finnhub_view.future_ipo(
             num_days_ahead=ns_parser.limit,
             export=ns_parser.export,
         )
Exemplo n.º 2
0
    def call_fipo(self, other_args: List[str]):
        """Process fipo command"""
        parser = argparse.ArgumentParser(
            add_help=False,
            formatter_class=argparse.ArgumentDefaultsHelpFormatter,
            prog="fipo",
            description="""
                Future IPOs dates. [Source: https://finnhub.io]
            """,
        )

        parser.add_argument(
            "-d",
            "--days",
            action="store",
            dest="days",
            type=check_non_negative,
            default=5,
            help="Number of days in the future to look for IPOs.",
        )

        parser.add_argument(
            "-s",
            "--end",
            type=valid_date,
            default=None,
            dest="end",
            help="""The end date (format YYYY-MM-DD) to look for IPOs, starting from today.
            When set, end date will override --days argument""",
        )

        parser.add_argument(
            "-l",
            "--limit",
            action="store",
            dest="limit",
            type=check_non_negative,
            default=20,
            help="Limit number of IPOs to display.",
        )

        if other_args and "-" not in other_args[0][0]:
            other_args.insert(0, "-l")
        ns_parser = parse_known_args_and_warn(
            parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED
        )

        if ns_parser:
            finnhub_view.future_ipo(
                num_days_ahead=ns_parser.days,
                limit=ns_parser.limit,
                end_date=ns_parser.end,
                export=ns_parser.export,
            )
    def call_fipo(self, other_args: List[str]):
        """Process fipo command"""
        parser = argparse.ArgumentParser(
            add_help=False,
            formatter_class=argparse.ArgumentDefaultsHelpFormatter,
            prog="fipo",
            description="""
                Future IPOs dates. [Source: https://finnhub.io]
            """,
        )
        parser.add_argument(
            "-n",
            "--num",
            action="store",
            dest="num",
            type=check_non_negative,
            default=5,
            help="Number of future days to look for IPOs.",
        )
        parser.add_argument(
            "--export",
            choices=["csv", "json", "xlsx"],
            default="",
            type=str,
            dest="export",
            help="Export dataframe data to csv,json,xlsx file",
        )
        try:
            if other_args:
                if "-" not in other_args[0]:
                    other_args.insert(0, "-n")

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

            finnhub_view.future_ipo(
                num_days_ahead=ns_parser.num,
                export=ns_parser.export,
            )

        except Exception as e:
            print(e, "\n")