Exemplo n.º 1
0
 def call_history(self, other_args: List[str]):
     """Process history command"""
     parser = argparse.ArgumentParser(
         add_help=False,
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
         prog="history",
         description="""Historical Portfolio Info""",
     )
     parser.add_argument(
         "-s",
         "--span",
         dest="span",
         type=str,
         choices=self.valid_span,
         default="3month",
         help="Span of historical data",
     )
     parser.add_argument(
         "-i",
         "--interval",
         dest="interval",
         default="day",
         choices=self.valid_interval,
         type=str,
         help="Interval to look at portfolio",
     )
     ns_parser = parse_known_args_and_warn(
         parser, other_args, export_allowed=EXPORT_ONLY_RAW_DATA_ALLOWED
     )
     if ns_parser:
         robinhood_view.display_historical(
             interval=ns_parser.interval,
             span=ns_parser.span,
             export=ns_parser.export,
         )
 def call_history(self, other_args: List[str]):
     """Process history command"""
     parser = argparse.ArgumentParser(
         add_help=False,
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
         prog="history",
         description="""Historical Portfolio Info""",
     )
     parser.add_argument(
         "-s",
         "--span",
         dest="span",
         type=str,
         choices=valid_span,
         default="3month",
         help="Span of historical data",
     )
     parser.add_argument(
         "-i",
         "--interval",
         dest="interval",
         default="day",
         choices=valid_interval,
         type=str,
         help="Interval to look at portfolio",
     )
     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
         robinhood_view.display_historical(
             interval=ns_parser.interval,
             span=ns_parser.span,
             export=ns_parser.export,
         )
     except Exception as e:
         print(e, "\n")