def call_usbonds(self, other_args: List[str]): """Process usbonds command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="usbonds", description="US Bonds. [Source: Wall St. Journal]", ) 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 wsj_view.display_usbonds(export=ns_parser.export, ) except Exception as e: print(e, "\n")
def call_usbonds(self, other_args: List[str]): """Process usbonds command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="usbonds", description="US Bonds. [Source: Wall St. Journal]", ) ns_parser = parse_known_args_and_warn( parser, other_args, export_allowed=EXPORT_ONLY_RAW_DATA_ALLOWED) if ns_parser: wsj_view.display_usbonds(export=ns_parser.export, )
def call_overview(self, other_args: List[str]): """Process overview command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="overview", description=""" Provide a market overview of a variety of options. This can be a general overview, indices, bonds and currencies. [Source: Wall St. Journal] """, ) parser.add_argument( "-t", "--type", dest="type", help= "Obtain either US indices, US Bonds, Global Bonds or Currencies", type=str, choices=self.overview_options, default="", ) if other_args and "-" not in other_args[0][0]: other_args.insert(0, "-t") ns_parser = parse_known_args_and_warn( parser, other_args, export_allowed=EXPORT_ONLY_RAW_DATA_ALLOWED) if ns_parser: if not ns_parser.type: wsj_view.display_overview(export=ns_parser.export, ) elif ns_parser.type == "indices": wsj_view.display_indices(export=ns_parser.export, ) if ns_parser.type == "usbonds": wsj_view.display_usbonds(export=ns_parser.export, ) if ns_parser.type == "glbonds": wsj_view.display_glbonds(export=ns_parser.export, ) if ns_parser.type == "currencies": wsj_view.display_currencies(export=ns_parser.export, )