Exemplo n.º 1
0
def test_screener_sort_matches(sort, mocker):
    # MOCK CHARTS
    mocker.patch.object(
        target=helper_funcs.gtff,
        attribute="USE_TABULATE_DF",
        new=True,
    )

    # MOCK EXPORT_DATA
    mocker.patch(
        target="gamestonk_terminal.stocks.screener.finviz_view.export_data",
    )

    # MOCK PROGRESS_BAR
    mocker.patch(
        target="finvizfinance.screener.overview.progressBar",
    )

    finviz_view.screener(
        loaded_preset="top_gainers",
        data_type="overview",
        limit=2,
        ascend=True,
        sort=sort,
        export="",
    )
Exemplo n.º 2
0
 def call_technical(self, other_args: List[str]):
     """Process technical command"""
     parser = argparse.ArgumentParser(
         add_help=False,
         prog="technical",
         description="""
             Prints technical data of the companies that meet the pre-set filtering.
         """,
     )
     parser.add_argument(
         "-p",
         "--preset",
         action="store",
         dest="preset",
         type=str,
         default=self.preset,
         help="Filter presets",
         choices=self.preset_choices + list(finviz_model.d_signals.keys()),
     )
     parser.add_argument(
         "-l",
         "--limit",
         action="store",
         dest="limit",
         type=check_positive,
         default=10,
         help="Limit of stocks to print",
     )
     parser.add_argument(
         "-a",
         "--ascend",
         action="store_true",
         default=False,
         dest="ascend",
         help="Set order to Ascend, the default is Descend",
     )
     parser.add_argument(
         "-s",
         "--sort",
         action="store",
         dest="sort",
         default="",
         nargs="+",
         choices=finviz_view.d_cols_to_sort["technical"],
         help="Sort elements of the table.",
     )
     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:
         self.screen_tickers = finviz_view.screener(
             loaded_preset=self.preset,
             data_type="technical",
             limit=ns_parser.limit,
             ascend=ns_parser.ascend,
             sort=ns_parser.sort,
             export=ns_parser.export,
         )
Exemplo n.º 3
0
def test_screener_no_data(data, mocker):
    # MOCK GET_SCREENER_DATA
    mocker.patch(
        target="gamestonk_terminal.stocks.screener.finviz_view.get_screener_data",
        return_value=data,
    )

    result = finviz_view.screener(
        loaded_preset="top_gainers",
        data_type="overview",
        limit=2,
        ascend=True,
        sort="",
        export="",
    )

    assert result == []  # pylint: disable=use-implicit-booleaness-not-comparison
Exemplo n.º 4
0
 def call_technical(self, other_args: List[str]):
     """Process technical command"""
     self.screen_tickers = finviz_view.screener(other_args, self.preset,
                                                "technical")
Exemplo n.º 5
0
 def call_performance(self, other_args: List[str]):
     """Process performance command"""
     self.screen_tickers = finviz_view.screener(other_args, self.preset,
                                                "performance")
Exemplo n.º 6
0
 def call_ownership(self, other_args: List[str]):
     """Process ownership command"""
     self.screen_tickers = finviz_view.screener(other_args, self.preset,
                                                "ownership")
Exemplo n.º 7
0
 def call_valuation(self, other_args: List[str]):
     """Process valuation command"""
     self.screen_tickers = finviz_view.screener(other_args, self.preset,
                                                "valuation")
Exemplo n.º 8
0
 def call_overview(self, other_args: List[str]):
     """Process overview command"""
     self.screen_tickers = finviz_view.screener(other_args, self.preset,
                                                "overview")