Exemplo n.º 1
0
    def call_stvl(self, other_args: List[str]):
        """Process stvl command"""
        parser = argparse.ArgumentParser(
            add_help=False,
            formatter_class=argparse.ArgumentDefaultsHelpFormatter,
            prog="stvl",
            description="""
                Displays historical values of the total sum of TVLs from all listed dApps.
                [Source: https://docs.llama.fi/api]
            """,
        )

        parser.add_argument(
            "-l",
            "--limit",
            dest="limit",
            type=check_positive,
            help="Number of records to display",
            default=10,
        )

        ns_parser = parse_known_args_and_warn(
            parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES)

        if ns_parser:
            llama_view.display_defi_tvl(top=ns_parser.limit,
                                        export=ns_parser.export)
Exemplo n.º 2
0
def test_display_defi_tvl(mocker):
    # MOCK CHARTS
    mocker.patch.object(target=llama_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")
    llama_view.display_defi_tvl(20)
def test_display_defi_tvl(mocker):
    # MOCK EXPORT_DATA
    mocker.patch(
        target="gamestonk_terminal.cryptocurrency.defi.llama_view.export_data")

    # MOCK VISUALIZE_OUTPUT
    mocker.patch(
        target=
        "gamestonk_terminal.helper_classes.TerminalStyle.visualize_output")

    llama_view.display_defi_tvl(20)
    def call_tvl(self, other_args: List[str]):
        """Process tvl command"""
        parser = argparse.ArgumentParser(
            add_help=False,
            formatter_class=argparse.ArgumentDefaultsHelpFormatter,
            prog="tvl",
            description="""
                Displays historical values of the total sum of TVLs from all listed protocols.
                [Source: https://docs.llama.fi/api]
            """,
        )

        parser.add_argument(
            "-t",
            "--top",
            dest="top",
            type=check_positive,
            help="top N number records",
            default=10,
        )

        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

            llama_view.display_defi_tvl(top=ns_parser.top,
                                        export=ns_parser.export)

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