Exemple #1
0
def test_ark_orders_view(kwargs_dict, mocker, use_color):
    yf_download = ark_view.ark_model.yf.download

    def mock_yf_download(*args, **kwargs):
        kwargs["threads"] = False
        return yf_download(*args, **kwargs)

    mocker.patch("yfinance.download", side_effect=mock_yf_download)

    mocker.patch.object(target=ark_view.gtff,
                        attribute="USE_COLOR",
                        new=use_color)
    ark_view.ark_orders_view(**kwargs_dict)
Exemple #2
0
    def call_arkord(self, other_args: List[str]):
        """Process arkord command"""
        parser = argparse.ArgumentParser(
            add_help=False,
            formatter_class=argparse.ArgumentDefaultsHelpFormatter,
            prog="arkord",
            description="""
                Orders by ARK Investment Management LLC - https://ark-funds.com/. [Source: https://cathiesark.com]
            """,
        )
        parser.add_argument(
            "-n",
            "--num",
            action="store",
            dest="n_num",
            type=check_positive,
            default=10,
            help="Last N ARK orders.",
        )
        parser.add_argument(
            "--export",
            choices=["csv", "json", "xlsx"],
            default="",
            type=str,
            dest="export",
            help="Export dataframe data to csv,json,xlsx file",
        )
        try:
            if other_args:
                if "-" not in other_args[0]:
                    other_args.insert(0, "-n")

            ns_parser = parse_known_args_and_warn(parser, other_args)
            if not ns_parser:
                return

            ark_view.ark_orders_view(
                num=ns_parser.n_num,
                export=ns_parser.export,
            )

        except Exception as e:
            print(e, "\n")
Exemple #3
0
 def call_arkord(self, other_args: List[str]):
     """Process arkord command"""
     parser = argparse.ArgumentParser(
         add_help=False,
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
         prog="arkord",
         description="""
             Orders by ARK Investment Management LLC - https://ark-funds.com/. [Source: https://cathiesark.com]
         """,
     )
     parser.add_argument(
         "-l",
         "--limit",
         action="store",
         dest="limit",
         type=check_positive,
         default=10,
         help="Limit of stocks to display.",
     )
     parser.add_argument(
         "-s",
         "--sortby",
         dest="sort_col",
         choices=self.arkord_sortby_choices,
         nargs="+",
         help="Column to sort by",
         default="",
     )
     parser.add_argument(
         "-a",
         "--ascend",
         dest="ascend",
         help="Flag to sort in ascending order",
         action="store_true",
         default=False,
     )
     parser.add_argument(
         "-b",
         "--buy_only",
         dest="buys_only",
         help="Flag to look at buys only",
         action="store_true",
         default=False,
     )
     parser.add_argument(
         "-c",
         "--sell_only",
         dest="sells_only",
         help="Flag to look at sells only",
         action="store_true",
         default=False,
     )
     parser.add_argument(
         "-f",
         "--fund",
         type=str,
         default="",
         help="Filter by fund",
         dest="fund",
         choices=self.arkord_fund_choices,
     )
     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:
         ark_view.ark_orders_view(
             num=ns_parser.limit,
             sort_col=ns_parser.sort_col,
             ascending=ns_parser.ascend,
             buys_only=ns_parser.buys_only,
             sells_only=ns_parser.sells_only,
             fund=ns_parser.fund,
             export=ns_parser.export,
         )
Exemple #4
0
def test_ark_orders_view_empty_df(mocker):
    mocker.patch(
        "gamestonk_terminal.stocks.discovery.ark_view.ark_model.get_ark_orders",
        return_value=pd.DataFrame(),
    )
    ark_view.ark_orders_view(num=2)
 def test_ark_orders_view(self, mock_add_order_total):
     mock_add_order_total.side_effect = mock_add_order_total_noop
     ark_orders_view(10, "")
 def test_ark_orders_view(self):
     ark_orders_view(10, "")