Пример #1
0
 def call_plot(self, other_args):
     """Process plot command"""
     parser = argparse.ArgumentParser(
         add_help=False,
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
         prog="plot",
         description="This function plots option payoff diagrams",
     )
     ns_parser = parse_known_args_and_warn(parser, other_args)
     if ns_parser:
         plot_payoff(
             self.current_price,
             self.options,
             self.underlying,
             self.ticker,
             self.expiration,
         )
Пример #2
0
def test_plot_payoff(mocker):
    # MOCK CHARTS
    mocker.patch(
        target=
        "gamestonk_terminal.stocks.options.yfinance_view.theme.visualize_output"
    )

    # MOCK EXPORT_DATA
    mocker.patch(
        target="gamestonk_terminal.stocks.options.yfinance_view.export_data")

    yfinance_view.plot_payoff(
        current_price=95.0,
        options=[],
        underlying=0,
        ticker="PM",
        expiration="2022-01-07",
    )
Пример #3
0
def test_plot_payoff(mocker):
    # MOCK CHARTS
    mocker.patch.object(target=yfinance_view.gtff,
                        attribute="USE_ION",
                        new=True)
    mocker.patch(
        target="gamestonk_terminal.stocks.options.yfinance_view.plt.ion")
    mocker.patch(
        target="gamestonk_terminal.stocks.options.yfinance_view.plt.show")

    # MOCK EXPORT_DATA
    mocker.patch(
        target="gamestonk_terminal.stocks.options.yfinance_view.export_data")

    yfinance_view.plot_payoff(
        current_price=95.0,
        options=[],
        underlying=0,
        ticker="PM",
        expiration="2022-01-07",
    )