예제 #1
0
 def call_messages(self, other_args: List[str]):
     """Process messages command"""
     parser = argparse.ArgumentParser(
         add_help=False,
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
         prog="messages",
         description=
         """Print up to 30 of the last messages on the board. [Source: Stocktwits]""",
     )
     parser.add_argument(
         "-l",
         "--limit",
         action="store",
         dest="limit",
         type=check_positive,
         default=30,
         help="limit messages shown.",
     )
     if other_args and "-" not in other_args[0][0]:
         other_args.insert(0, "-l")
     ns_parser = parse_known_args_and_warn(parser, other_args)
     if ns_parser:
         if self.ticker:
             stocktwits_view.display_messages(ticker=self.ticker,
                                              limit=ns_parser.limit)
         else:
             console.print(
                 "No ticker loaded. Please load using 'load <ticker>'\n")
예제 #2
0
 def call_messages(self, other_args: List[str]):
     """Process messages command"""
     parser = argparse.ArgumentParser(
         add_help=False,
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
         prog="messages",
         description=
         """Print up to 30 of the last messages on the board. [Source: Stocktwits]""",
     )
     parser.add_argument(
         "-l",
         "--limit",
         action="store",
         dest="n_lim",
         type=check_positive,
         default=30,
         help="limit messages shown.",
     )
     try:
         ns_parser = parse_known_args_and_warn(parser, other_args)
         if not ns_parser:
             return
         if self._check_ticker():
             stocktwits_view.display_messages(ticker=self.ticker,
                                              limit=ns_parser.n_lim)
     except Exception as e:
         print(e, "\n")