def call_asc(self, other_args: List[str]): """Process asc command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="asc", description=""" Print up to 25 small cap stocks with earnings growth rates better than 25%. [Source: Yahoo Finance] """, ) parser.add_argument( "-l", "--limit", action="store", dest="limit", type=check_int_range(1, 25), default=5, help="Limit of stocks 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: yahoofinance_view.display_asc( num_stocks=ns_parser.limit, export=ns_parser.export, )
def call_asc(self, other_args: List[str]): """Process asc command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="asc", description=""" Print up to 25 small cap stocks with earnings growth rates better than 25%. [Source: Yahoo Finance] """, ) parser.add_argument( "-n", "--num", action="store", dest="num", type=check_int_range(1, 25), default=5, help="Number of the stocks to display.", ) 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 yahoofinance_view.display_asc( num_stocks=ns_parser.num, export=ns_parser.export, ) except Exception as e: print(e, "\n")