def call_analyst(self, other_args: List[str]): """Process analyst command""" parser = argparse.ArgumentParser( add_help=False, prog="analyst", description=""" Print analyst prices and ratings of the company. The following fields are expected: date, analyst, category, price from, price to, and rating. [Source: Finviz] """, ) 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 finviz_view.analyst(ticker=self.ticker, export=ns_parser.export) except Exception as e: print(e, "\n")
def call_analyst(self, other_args: List[str]): """Process analyst command""" parser = argparse.ArgumentParser( add_help=False, prog="analyst", description=""" Print analyst prices and ratings of the company. The following fields are expected: date, analyst, category, price from, price to, and rating. [Source: Finviz] """, ) ns_parser = parse_known_args_and_warn(parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED) if ns_parser: finviz_view.analyst(ticker=self.ticker, export=ns_parser.export)
def test_analyst(mocker): # REMOVE FINVIZ STOCK_PAGE CACHE mocker.patch.object(target=finviz.main_func, attribute="STOCK_PAGE", new={}) finviz_view.analyst(ticker="TSLA", export=None)