市值:

CoinMarketCap公共程序编程接口(API)文档

第二版


端点汇总

公共应用程序编程接口(API)端点

列表

  • 端点: /listings/
  • 方法: GET
  • 描述: 该端点将显示一次查询下的所有活跃加密货币列表,使用代码端点的“id”区以查询某加密货币的详细信息。
  • 例子: https://api.coinmarketcap.com/v2/listings/
  • 回复样本:
    {
        "data": [
            {
                "id": 1, 
                "name": "Bitcoin", 
                "symbol": "BTC", 
                "website_slug": "bitcoin"
            }, 
            {
                "id": 2, 
                "name": "Litecoin", 
                "symbol": "LTC", 
                "website_slug": "litecoin"
            }, 
            ...
        },
        "metadata": {
            "timestamp": 1525137187, 
            "num_cryptocurrencies": 1602, 
            "error": null
        }
    ]                               

代码

  • 端点: /ticker/
  • 方法: GET
  • 描述: 该端点将按序显示加密货币的代码,最大索引数量为100,可使用startlimit参数进行分页编码。
  • 可选参数:
    • (int) start - 索引结果从某个特定数起始(默认值为1
    • (int) limit - 索引结果最多显示 [limit] 项(默认值为100;最大值为100
    • (string) sort - 索引结果按照 [sort] 排列,可选参数为idrankvolume_24hpercent_change_24h(默认值为rank).
      注:若将所有索引结果进行分页编码,强烈推荐按照id排序,因为id是唯一一个能够确保索引排序一致的可选参数。
    • (string) structure - 指定主数据区的数据结构,可选参数为dictionaryarray(默认值为dictionary).
    • (string) convert - 显示基于另一币种的定价信息。
      可用法定通货货币为:"AUD", "BRL","CAD", CHF","CLP","CNY","CZK","DKK","EUR","GBP","HKD","HUF","IDR","ILS","INR","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PKR","PLN","RUB","SEK","SGD","THB","TRY","TWD","ZAR"
      可用加密货币为:"BTC","ETH","XRP","LTC","BCH"
  • 例子: https://api.coinmarketcap.com/v2/ticker/
  • 例子: https://api.coinmarketcap.com/v2/ticker/?limit=10
  • 例子: https://api.coinmarketcap.com/v2/ticker/?limit=10&sort=id
  • 例子: https://api.coinmarketcap.com/v2/ticker/?start=101&limit=10
  • 例子: https://api.coinmarketcap.com/v2/ticker/?start=101&limit=10&sort=id
  • 例子: https://api.coinmarketcap.com/v2/ticker/?start=101&limit=10&sort=id&structure=array
  • 例子: https://api.coinmarketcap.com/v2/ticker/?convert=EUR&limit=10
  • 例子: https://api.coinmarketcap.com/v2/ticker/?convert=BTC&limit=10
  • 回复样本:
    {
        "data": {
            "1": {
                "id": 1, 
                "name": "Bitcoin", 
                "symbol": "BTC", 
                "website_slug": "bitcoin", 
                "rank": 1, 
                "circulating_supply": 17008162.0, 
                "total_supply": 17008162.0, 
                "max_supply": 21000000.0, 
                "quotes": {
                    "USD": {
                        "price": 9024.09, 
                        "volume_24h": 8765400000.0, 
                        "market_cap": 153483184623.0, 
                        "percent_change_1h": -2.31, 
                        "percent_change_24h": -4.18, 
                        "percent_change_7d": -0.47
                    }
                }, 
                "last_updated": 1525137271
            }, 
            "1027": {
                "id": 1027, 
                "name": "Ethereum", 
                "symbol": "ETH", 
                "website_slug": "ethereum", 
                "rank": 2, 
                "circulating_supply": 99151888.0, 
                "total_supply": 99151888.0, 
                "max_supply": null, 
                "quotes": {
                    "USD": {
                        "price": 642.399, 
                        "volume_24h": 2871290000.0, 
                        "market_cap": 63695073558.0, 
                        "percent_change_1h": -3.75, 
                        "percent_change_24h": -7.01, 
                        "percent_change_7d": -2.32
                    }
                }, 
                "last_updated": 1525137260
            } 
            ...
        },
        "metadata": {
            "timestamp": 1525137187, 
            "num_cryptocurrencies": 1602, 
            "error": null
        }
    ]                               

代码(指定货币)

  • 端点: /ticker/{id}/
  • 方法: GET
  • 描述: 该端点将显示指定加密货币的代码数据,可使用链接中的列表端点的“id”栏。
  • 可选参数:
    • (string) structure - 指定主数据区的数据结构,可选参数为dictionaryarray(默认值为dictionary).
    • (string) convert - 显示基于另一币种的定价信息。
      可用法定通货货币为:"AUD", "BRL","CAD", CHF","CLP","CNY","CZK","DKK","EUR","GBP","HKD","HUF","IDR","ILS","INR","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PKR","PLN","RUB","SEK","SGD","THB","TRY","TWD","ZAR"
      可用加密货币为:"BTC","ETH","XRP","LTC","BCH"
  • 例子: https://api.coinmarketcap.com/v2/ticker/1/
  • 例子: https://api.coinmarketcap.com/v2/ticker/1/?structure=array
  • 例子: https://api.coinmarketcap.com/v2/ticker/1/?convert=EUR
  • 例子: https://api.coinmarketcap.com/v2/ticker/1/?convert=BCH
  • 回复样本:
    {
        "data": {
            "id": 1, 
            "name": "Bitcoin", 
            "symbol": "BTC", 
            "website_slug": "bitcoin", 
            "rank": 1, 
            "circulating_supply": 17008162.0, 
            "total_supply": 17008162.0, 
            "max_supply": 21000000.0, 
            "quotes": {
                "USD": {
                    "price": 9024.09, 
                    "volume_24h": 8765400000.0, 
                    "market_cap": 153483184623.0, 
                    "percent_change_1h": -2.31, 
                    "percent_change_24h": -4.18, 
                    "percent_change_7d": -0.47
                }
            }, 
            "last_updated": 1525137271
        },
        "metadata": {
            "timestamp": 1525237332, 
            "error": null
        }
    }               
  • 错误回复样本:
    {
        "data": null, 
        "metadata": {
            "timestamp": 1525137187, 
            "error": "id not found"
        }
    }

全球数据

  • 端点: /global/
  • 方法: GET
  • 描述: 该端点将显示coinmarketcap.com上的全球数据最高值。
  • 可选参数:
    • (string) convert - 显示基于另一币种的定价信息。
      可用法定通货货币为:"AUD", "BRL","CAD", CHF","CLP","CNY","CZK","DKK","EUR","GBP","HKD","HUF","IDR","ILS","INR","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PKR","PLN","RUB","SEK","SGD","THB","TRY","TWD","ZAR"
      可用加密货币为:"BTC","ETH","XRP","LTC","BCH"
  • 例子: https://api.coinmarketcap.com/v2/global/
  • 例子: https://api.coinmarketcap.com/v2/global/?convert=EUR
  • 例子: https://api.coinmarketcap.com/v2/global/?convert=BTC
  • 回复样本:
    {
        "data": {
            "active_cryptocurrencies": 1594, 
            "active_markets": 10526, 
            "bitcoin_percentage_of_market_cap": 37.65, 
            "quotes": {
                "USD": {
                    "total_market_cap": 407690157494.0, 
                    "total_volume_24h": 30969801118.0
                }
            }, 
            "last_updated": 1525137271
        },
        "metadata": {
            "timestamp": 1525237332, 
            "error": null
        }
    }                       

其他

限制

  • 请限制每分钟请求不超过30次。
  • 端点每五分钟更新一次。

使用条款

  • 接入公共应用程序编程接口(API)将表明您同意受使用条款的约束.

在寻找第一版公共应用程序编程接口(API)文档?

文档最近更新时间

  • 2018年05月20日