def call_rtps(self, other_args: List[str]): """Process rtps command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="rtps", description=""" Real-time and historical sector performances calculated from S&P500 incumbents. Pops plot in terminal. [Source: Alpha Vantage] """, ) parser.add_argument( "--raw", action="store_true", dest="raw", help="Only output raw data", ) ns_parser = parse_known_args_and_warn( parser, other_args, export_allowed=EXPORT_BOTH_RAW_DATA_AND_FIGURES) if ns_parser: alphavantage_view.realtime_performance_sector( raw=ns_parser.raw, export=ns_parser.export, )
def test_realtime_performance_sector(mocker, raw): # MOCK VISUALIZE_OUTPUT mocker.patch( target= "gamestonk_terminal.helper_classes.TerminalStyle.visualize_output") # MOCK EXPORT_DATA mocker.patch( target="gamestonk_terminal.economy.alphavantage_view.export_data") alphavantage_view.realtime_performance_sector( raw=raw, export="", )
def call_rtps(self, other_args: List[str]): """Process rtps command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="rtps", description=""" Real-time and historical sector performances calculated from S&P500 incumbents. Pops plot in terminal. [Source: Alpha Vantage] """, ) parser.add_argument( "--raw", action="store_true", dest="raw", help="Only output raw data", ) parser.add_argument( "--export", choices=["csv", "json", "xlsx"] if "--raw" in other_args else ["png", "jpg", "pdf", "svg"], default="", type=str, dest="export", help="Export data to csv,json,xlsx or png,jpg,pdf,svg file", ) try: ns_parser = parse_known_args_and_warn(parser, other_args) if not ns_parser: return alphavantage_view.realtime_performance_sector( raw=ns_parser.raw, export=ns_parser.export, ) except Exception as e: print(e, "\n")
def test_realtime_performance_sector(mocker, raw, tab): # MOCK GTFF mocker.patch.object(target=alphavantage_view.gtff, attribute="USE_TABULATE_DF", new=tab) mocker.patch.object(target=alphavantage_view.gtff, attribute="USE_ION", new=True) # MOCK ION + SHOW mocker.patch( target="gamestonk_terminal.stocks.options.yfinance_view.plt.ion") mocker.patch( target="gamestonk_terminal.stocks.options.yfinance_view.plt.show") # MOCK EXPORT_DATA mocker.patch( target="gamestonk_terminal.economy.alphavantage_view.export_data") alphavantage_view.realtime_performance_sector( raw=raw, export="", )