def display_basic(coin_id: str, export: str) -> None:
    """Get basic information for coin. Like:
        name, symbol, rank, type, description, platform, proof_type, contract, tags, parent.  [Source: CoinPaprika]

    Parameters
    ----------
    coin_id: str
        Identifier of coin for CoinPaprika API
    export: str
        Export dataframe data to csv,json,xlsx
    """

    df = coinpaprika_model.basic_coin_info(coin_id)

    if df.empty:
        console.print("No data available\n")
        return

    print_rich_table(df,
                     headers=list(df.columns),
                     show_index=False,
                     title="Basic Coin Information")

    export_data(
        export,
        os.path.dirname(os.path.abspath(__file__)),
        "basic",
        df,
    )
Example #2
0
def basic(coin_id: str, other_args: List[str]):
    """Get basic information for coin. Like:
        name, symbol, rank, type, description, platform, proof_type,
        contract, tags, parent

    Parameters
    ----------
    coin_id: str
        Identifier of coin for CoinPaprika API
    other_args: List[str]
        Arguments to pass to argparse

    """
    parser = argparse.ArgumentParser(
        prog="basic",
        add_help=False,
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        description="""Get basic information for coin. Like:
            name, symbol, rank, type, description, platform, proof_type,
            contract, tags, parent""",
    )

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

        df = paprika.basic_coin_info(coin_id)

        if df.empty:
            print("No data available\n")
            return

        print(
            tabulate(
                df,
                headers=df.columns,
                floatfmt=".0f",
                showindex=False,
                tablefmt="fancy_grid",
            ),
            "\n",
        )
    except Exception as e:
        print(e, "\n")
Example #3
0
def display_basic(coin_id: str, export: str) -> None:
    """Get basic information for coin. Like:
        name, symbol, rank, type, description, platform, proof_type, contract, tags, parent.  [Source: CoinPaprika]

    Parameters
    ----------
    coin_id: str
        Identifier of coin for CoinPaprika API
    export: str
        Export dataframe data to csv,json,xlsx
    """

    df = coinpaprika_model.basic_coin_info(coin_id)

    if df.empty:
        print("No data available\n")
        return

    if gtff.USE_TABULATE_DF:
        print(
            tabulate(
                df,
                headers=df.columns,
                floatfmt=".0f",
                showindex=False,
                tablefmt="fancy_grid",
            ),
            "\n",
        )
    else:
        print(df.to_string, "\n")

    export_data(
        export,
        os.path.dirname(os.path.abspath(__file__)),
        "basic",
        df,
    )