コード例 #1
0
 def call_lins(self, other_args: List[str]):
     """Process lins command"""
     parser = argparse.ArgumentParser(
         add_help=False,
         prog="lins",
         description="""
             Prints information about inside traders. The following fields are expected: Date, Relationship,
             Transaction, #Shares, Cost, Value ($), #Shares Total, Insider Trading, SEC Form 4. [Source: Finviz]
         """,
     )
     parser.add_argument(
         "-l",
         "--limit",
         action="store",
         dest="limit",
         type=check_positive,
         default=10,
         help="Limit of latest inside traders.",
     )
     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,
                                           EXPORT_ONLY_RAW_DATA_ALLOWED)
     if ns_parser:
         if self.ticker:
             finviz_view.last_insider_activity(
                 ticker=self.ticker,
                 num=ns_parser.limit,
                 export=ns_parser.export,
             )
         else:
             print("No ticker loaded. First use `load {ticker}`\n")
コード例 #2
0
def test_last_insider_activity_none(mocker):
    # REMOVE FINVIZ STOCK_PAGE CACHE
    mocker.patch.object(target=finviz.main_func,
                        attribute="STOCK_PAGE",
                        new={})

    finviz_view.last_insider_activity(ticker="AAL", num=5, export="")
コード例 #3
0
    def call_lins(self, other_args: List[str]):
        """Process lins command"""
        parser = argparse.ArgumentParser(
            add_help=False,
            prog="lins",
            description="""
                Prints information about inside traders. The following fields are expected: Date, Relationship,
                Transaction, #Shares, Cost, Value ($), #Shares Total, Insider Trading, SEC Form 4. [Source: Finviz]
            """,
        )
        parser.add_argument(
            "-n",
            "--num",
            action="store",
            dest="n_num",
            type=check_positive,
            default=10,
            help="number of latest inside traders.",
        )
        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

            if not self.ticker:
                print("No ticker loaded.  First use `load {ticker}` \n")
                return

            finviz_view.last_insider_activity(
                ticker=self.ticker,
                num=ns_parser.n_num,
                export=ns_parser.export,
            )

        except Exception as e:
            print(e, "\n")