def call_cashflow(self, other_args: List[str]): """Process cashflow command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="cashflow", description=""" Prints either yearly or quarterly cashflow statement the company, and compares it against similar companies. """, ) parser.add_argument( "-q", "--quarter", action="store_true", default=False, dest="b_quarter", help="Quarter financial data flag.", ) parser.add_argument( "-t", "--timeframe", dest="s_timeframe", type=str, default=None, help="Specify yearly/quarterly timeframe. Default is last.", ) ns_parser = parse_known_args_and_warn(parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED) if ns_parser: marketwatch_view.display_cashflow_comparison( similar=self.similar, timeframe=ns_parser.s_timeframe, quarter=ns_parser.b_quarter, )
def test_display_cashflow_comparison(mocker): mocker.patch.object( target=marketwatch_view.rich_config, attribute="USE_COLOR", new=True, ) marketwatch_view.display_cashflow_comparison( similar=["TSLA", "GM"], timeframe="31-Dec-2020", quarter=True, export="", )
def call_cashflow(self, other_args: List[str]): """Process cashflow command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="cashflow", description=""" Prints either yearly or quarterly cashflow statement the company, and compares it against similar companies. """, ) parser.add_argument( "-q", "--quarter", action="store_true", default=False, dest="b_quarter", help="Quarter financial data flag.", ) parser.add_argument( "-t", "--timeframe", dest="s_timeframe", type=str, default=None, help="Specify yearly/quarterly timeframe. Default is last.", ) 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 marketwatch_view.display_cashflow_comparison( ticker=self.ticker, similar=self.similar, timeframe=ns_parser.s_timeframe, quarter=ns_parser.b_quarter, ) except Exception as e: print(e, "\n")