项目作者: ExodusMovement

项目描述 :
Price and market capitalization from coinmarketcap.com
高级语言: JavaScript
项目地址: git://github.com/ExodusMovement/coinmarketcap.git
创建时间: 2016-02-12T16:28:41Z
项目社区:https://github.com/ExodusMovement/coinmarketcap

开源协议:MIT License

下载


coinmarketcap

NPM Package
Build Status

js-standard-style

API

ticker([options])

Get a list of assets and their info.

  • options (Object) Optional.
    • limit (Number) Only return the top limit assets. Default is to get all assets.
    • convert (String) Return price, 24h volume, and market cap in terms of another currency.

Returns a promise.

Example:

  1. await coinmarketcap.ticker({
  2. limit: 10,
  3. convert: 'eur'
  4. })
  5. // [
  6. // {
  7. // "id": "bitcoin",
  8. // "name": "Bitcoin",
  9. // "symbol": "BTC",
  10. // "rank": "1",
  11. // "price_usd": "1030.06",
  12. // "price_btc": "1.0",
  13. // "24h_volume_usd": "321117000.0",
  14. // "market_cap_usd": "16733968488.0",
  15. // "available_supply": "16245625.0",
  16. // "total_supply": "16245625.0",
  17. // "percent_change_1h": "0.52",
  18. // "percent_change_24h": "-1.01",
  19. // "percent_change_7d": "-1.77",
  20. // "last_updated": "1490895549",
  21. // "price_eur": "960.3403889",
  22. // "volume_eur": "299382195.855",
  23. // "market_cap_eur": "15601329830.0"
  24. // },
  25. // ... (9 more)
  26. // ]

tickerByAsset(assetID, [options])

Get info about a particular asset.

  • assetID (String) Asset ID (i.e 'bitcoin')
  • options (Object) Optional.
    • convert (String) Return price, 24h volume, and market cap in terms of another currency.

Returns a promise.

Example:

  1. await coinmarketcap.tickerByAsset('bitcoin', { convert: 'eur' })
  2. // {
  3. // "id": "bitcoin",
  4. // "name": "Bitcoin",
  5. // "symbol": "BTC",
  6. // "rank": "1",
  7. // "price_usd": "1030.06",
  8. // "price_btc": "1.0",
  9. // "24h_volume_usd": "321117000.0",
  10. // "market_cap_usd": "16733968488.0",
  11. // "available_supply": "16245625.0",
  12. // "total_supply": "16245625.0",
  13. // "percent_change_1h": "0.52",
  14. // "percent_change_24h": "-1.01",
  15. // "percent_change_7d": "-1.77",
  16. // "last_updated": "1490895549",
  17. // "price_eur": "960.3403889",
  18. // "volume_eur": "299382195.855",
  19. // "market_cap_eur": "15601329830.0"
  20. // }

global([options])

Get global info.

  • options (Object) Optional.
    • convert (String) Return 24h volume, and market cap in terms of another currency.

Returns a promise.

Example:

  1. await coinmarketcap.ticker()
  2. // {
  3. // "total_market_cap_usd": 24854674203.0,
  4. // "total_24h_volume_usd": 694102237.0,
  5. // "bitcoin_percentage_of_market_cap": 67.33,
  6. // "active_currencies": 680,
  7. // "active_assets": 80,
  8. // "active_markets": 2817
  9. // }

License

MIT