Esempio n. 1
0
def test_view_screener_output(mocker):
    # MOCK VISUALIZE_OUTPUT
    mocker.patch(
        target="gamestonk_terminal.helper_classes.TerminalStyle.visualize_output"
    )
    presets_path = os.path.join(os.path.dirname(syncretism_view.__file__), "presets/")
    syncretism_view.view_screener_output(
        preset="high_IV",
        presets_path=presets_path,
        n_show=5,
        export="",
    )
Esempio n. 2
0
def test_view_screener_output_error(mocker):
    mocker.patch(
        target="gamestonk_terminal.stocks.options.syncretism_view.syncretism_model.get_screener_output",
        return_value=(pd.DataFrame(), "MOCK_ERROR_MESSAGE"),
    )
    presets_path = os.path.join(os.path.dirname(syncretism_view.__file__), "presets/")
    syncretism_view.view_screener_output(
        preset="high_IV",
        presets_path=presets_path,
        n_show=5,
        export="",
    )
Esempio n. 3
0
def test_view_screener_output(mocker, tab):
    # MOCK CHARTS
    mocker.patch.object(
        target=syncretism_view.gtff,
        attribute="USE_TABULATE_DF",
        new=tab,
    )
    presets_path = os.path.join(os.path.dirname(syncretism_view.__file__),
                                "presets/")
    syncretism_view.view_screener_output(
        preset="high_IV",
        presets_path=presets_path,
        n_show=5,
        export="",
    )
    def call_scr(self, other_args: List[str]):
        """Process scr command"""
        parser = argparse.ArgumentParser(
            add_help=False,
            formatter_class=argparse.ArgumentDefaultsHelpFormatter,
            prog="scr",
            description=
            """Screener filter output from https://ops.syncretism.io/index.html.
        Where: CS: Contract Symbol; S: Symbol, T: Option Type; Str: Strike; Exp v: Expiration;
        IV: Implied Volatility; LP: Last Price; B: Bid; A: Ask; V: Volume; OI: Open Interest;
        Y: Yield; MY: Monthly Yield; SMP: Regular Market Price; SMDL: Regular Market Day Low;
        SMDH: Regular Market Day High; LU: Last Trade Date; LC: Last Crawl; ITM: In The Money;
        PC: Price Change; PB: Price-to-book. """,
        )
        parser.add_argument(
            "-p",
            "--preset",
            action="store",
            dest="preset",
            type=str,
            default=self.preset,
            help="Filter presets",
            choices=self.preset_choices,
        )
        parser.add_argument(
            "-l",
            "--limit",
            type=check_positive,
            default=10,
            help="Limit of random entries to display. Default shows all",
            dest="limit",
        )

        if other_args and "-" not in other_args[0][0]:
            other_args.insert(0, "-p")
        ns_parser = parse_known_args_and_warn(parser, other_args,
                                              EXPORT_ONLY_RAW_DATA_ALLOWED)
        if ns_parser:
            self.screen_tickers = syncretism_view.view_screener_output(
                preset=ns_parser.preset,
                presets_path=self.presets_path,
                n_show=ns_parser.limit,
                export=ns_parser.export,
            )