Class CMC

Classdesc

Class used to fetch cryptocurrency information from the CoinMarketCap API.

Param

Class Options (CoinMarketCap API Key)

Hierarchy

  • CMC

Constructors

Properties

key: string
url: string

Methods

  • Fetches information on a specific cryptocurrency market or group of markets via their CoinMarketCap ID E.g 1 for Bitcoin, 2 for Ethereum. To fetch multiple markets seperate each identifier with a comma.

    Example

    const cmc = new CMC({ key: "YOUR_API_KEY" });
    const info = await cmc.getQuotesByID("1,2");
    console.log(info);

    Returns

    An object/objects with the following properties:

    Returns

    id - The CoinMarketCap ID of the cryptocurrency.

    Returns

    name - The name of the cryptocurrency.

    Returns

    symbol - The symbol of the cryptocurrency.

    Returns

    slug - The slug of the cryptocurrency.

    Returns

    num_market_pairs - The number of markets the cryptocurrency is listed on.

    Returns

    date_added - The date the cryptocurrency was added to CoinMarketCap.

    Returns

    tags - A list of tags associated with the cryptocurrency.

    Returns

    max_supply - The maximum supply of the cryptocurrency.

    Returns

    circulating_supply - The circulating supply of the cryptocurrency.

    Returns

    total_supply - The total supply of the cryptocurrency.

    Returns

    platform - The platform the cryptocurrency is built on.

    Returns

    cmc_rank - The CoinMarketCap rank of the cryptocurrency.

    Returns

    last_updated - The last time the cryptocurrency was updated.

    Returns

    quote - The quote information for the cryptocurrency.

    Returns

    quote.USD - The USD quote information for the cryptocurrency.

    Returns

    quote.USD.price - The USD price of the cryptocurrency.

    Returns

    quote.USD.volume_24h - The USD volume of the cryptocurrency in the last 24 hours.

    Returns

    quote.USD.percent_change_1h - The percent change of the cryptocurrency in the last hour.

    Returns

    quote.USD.percent_change_24h - The percent change of the cryptocurrency in the last 24 hours.

    Returns

    quote.USD.percent_change_7d - The percent change of the cryptocurrency in the last 7 days.

    Returns

    quote.USD.percent_change_30d - The percent change of the cryptocurrency in the last 30 days.

    Returns

    quote.USD.percent_change_60d - The percent change of the cryptocurrency in the last 60 days.

    Returns

    quote.USD.percent_change_90d - The percent change of the cryptocurrency in the last 90 days.

    Returns

    quote.USD.market_cap - The USD market cap of the cryptocurrency.

    Returns

    quote.USD.last_updated - The last time the cryptocurrency was updated.

    Parameters

    • id: string

      The id of the cryptocurrency you want to get the quote for.

    Returns Promise<any>

  • Fetches information on a specific cryptocurrency market or group of markets via their slug(name) E.g bitcoin, ethereum. To fetch multiple markets seperate each identifier with a comma.

    Example

    const cmc = new CMC({ key: "YOUR_API_KEY" });
    const info = await cmc.getQuotesBySlug("bitcoin,ethereum");
    console.log(info);

    Returns

    An object/objects with the following properties:

    Returns

    id - The CoinMarketCap ID of the cryptocurrency.

    Returns

    name - The name of the cryptocurrency.

    Returns

    symbol - The symbol of the cryptocurrency.

    Returns

    slug - The slug of the cryptocurrency.

    Returns

    num_market_pairs - The number of markets the cryptocurrency is listed on.

    Returns

    date_added - The date the cryptocurrency was added to CoinMarketCap.

    Returns

    tags - A list of tags associated with the cryptocurrency.

    Returns

    max_supply - The maximum supply of the cryptocurrency.

    Returns

    circulating_supply - The circulating supply of the cryptocurrency.

    Returns

    total_supply - The total supply of the cryptocurrency.

    Returns

    platform - The platform the cryptocurrency is built on.

    Returns

    cmc_rank - The CoinMarketCap rank of the cryptocurrency.

    Returns

    last_updated - The last time the cryptocurrency was updated.

    Returns

    quote - The quote information for the cryptocurrency.

    Returns

    quote.USD - The USD quote information for the cryptocurrency.

    Returns

    quote.USD.price - The USD price of the cryptocurrency.

    Returns

    quote.USD.volume_24h - The USD volume of the cryptocurrency in the last 24 hours.

    Returns

    quote.USD.percent_change_1h - The percent change of the cryptocurrency in the last hour.

    Returns

    quote.USD.percent_change_24h - The percent change of the cryptocurrency in the last 24 hours.

    Returns

    quote.USD.percent_change_7d - The percent change of the cryptocurrency in the last 7 days.

    Returns

    quote.USD.percent_change_30d - The percent change of the cryptocurrency in the last 30 days.

    Returns

    quote.USD.percent_change_60d - The percent change of the cryptocurrency in the last 60 days.

    Returns

    quote.USD.percent_change_90d - The percent change of the cryptocurrency in the last 90 days.

    Returns

    quote.USD.market_cap - The USD market cap of the cryptocurrency.

    Returns

    quote.USD.last_updated - The last time the cryptocurrency was updated.

    Parameters

    • slug: string

      The slug of the cryptocurrency you want to get the quotes for.

    Returns Promise<any>

  • Fetches information on a specific cryptocurrency market or group of markets via their symbol E.g BTC, ETH. To fetch multiple markets seperate each identifier with a comma.

    Example

    const cmc = new CMC({ key: "YOUR_API_KEY" });
    const info = await cmc.getQuotesBySymbol("BTC,ETH");
    console.log(info);

    Returns

    An object/objects with the following properties:

    Returns

    id - The CoinMarketCap ID of the cryptocurrency.

    Returns

    name - The name of the cryptocurrency.

    Returns

    symbol - The symbol of the cryptocurrency.

    Returns

    slug - The slug of the cryptocurrency.

    Returns

    num_market_pairs - The number of markets the cryptocurrency is listed on.

    Returns

    date_added - The date the cryptocurrency was added to CoinMarketCap.

    Returns

    tags - A list of tags associated with the cryptocurrency.

    Returns

    max_supply - The maximum supply of the cryptocurrency.

    Returns

    circulating_supply - The circulating supply of the cryptocurrency.

    Returns

    total_supply - The total supply of the cryptocurrency.

    Returns

    platform - The platform the cryptocurrency is built on.

    Returns

    cmc_rank - The CoinMarketCap rank of the cryptocurrency.

    Returns

    last_updated - The last time the cryptocurrency was updated.

    Returns

    quote - The quote information for the cryptocurrency.

    Returns

    quote.USD - The USD quote information for the cryptocurrency.

    Returns

    quote.USD.price - The USD price of the cryptocurrency.

    Returns

    quote.USD.volume_24h - The USD volume of the cryptocurrency in the last 24 hours.

    Returns

    quote.USD.percent_change_1h - The percent change of the cryptocurrency in the last hour.

    Returns

    quote.USD.percent_change_24h - The percent change of the cryptocurrency in the last 24 hours.

    Returns

    quote.USD.percent_change_7d - The percent change of the cryptocurrency in the last 7 days.

    Returns

    quote.USD.percent_change_30d - The percent change of the cryptocurrency in the last 30 days.

    Returns

    quote.USD.percent_change_60d - The percent change of the cryptocurrency in the last 60 days.

    Returns

    quote.USD.percent_change_90d - The percent change of the cryptocurrency in the last 90 days.

    Returns

    quote.USD.market_cap - The USD market cap of the cryptocurrency.

    Returns

    quote.USD.last_updated - The last time the cryptocurrency was updated.

    Parameters

    • symbol: string

      The symbol of the cryptocurrency you want to get quotes for.

    Returns Promise<any>

  • Private

    Base Fetch Method to CMC API and Authentication

    Returns

    Information on Specific Endpoint

    Parameters

    • options: reqOptions

      reqOptions

    Returns Promise<any>

Generated using TypeDoc