def call_rating(self, other_args: List[str]): """Process rating command""" parser = argparse.ArgumentParser( add_help=False, prog="rating", description=""" Based on specific ratios, prints information whether the company is a (strong) buy, neutral or a (strong) sell. The following fields are expected: P/B, ROA, DCF, P/E, ROE, and D/E. [Source: Financial Modeling Prep] """, ) parser.add_argument( "-l", "--limit", action="store", dest="limit", type=check_positive, default=10, help="limit of last days to display ratings", ) 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: fmp_view.rating( ticker=self.ticker, num=ns_parser.limit, export=ns_parser.export, )
def call_rating(self, other_args: List[str]): """Process rating command""" parser = argparse.ArgumentParser( add_help=False, prog="rating", description=""" Based on specific ratios, prints information whether the company is a (strong) buy, neutral or a (strong) sell. The following fields are expected: P/B, ROA, DCF, P/E, ROE, and D/E. [Source: Financial Modeling Prep] """, ) parser.add_argument( "-n", "--num", action="store", dest="n_num", type=check_positive, default=10, help="number of last days to display ratings", ) 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 fmp_view.rating( ticker=self.ticker, num=ns_parser.n_num, export=ns_parser.export, ) except Exception as e: print(e, "\n")
def test_rating(): fmp_view.rating(ticker="TSLA", num=5, export=None)