Coinmarketcap_api_ex v2.0.0 released [open source Elixir/Erlang client for coinmarketcap.com]

in #utopian-io7 years ago (edited)

This release implements support for the second version of Coinmarketcap API with minimal changes to API structure.

All CMC API endpoints are called using fetch_#{endpoint} functions and return success tuple with %CoinmarketcapApi.Response{} containing :data and :metadata.

Configuration

Configuration is not required.

Links

Documentation

More docs and example return values can be found at hexdocs.

Tickers

All ticker related functions return either a Ticker struct or a list of Ticker structs.
Examples:

  • CoinmarketcapApi.fetch_ticker()
  • CoinmarketcapApi.fetch_ticker([start: 100, limit: 50])
  • CoinmarketcapApi.fetch_ticker([start: 100, limit: 50, convert: "EUR"])
  • CoinmarketcapApi.fetch_ticker(1)
  • CoinmarketcapApi.fetch_ticker(1, convert: "EUR")

Ticker structs have the following shape:

%CoinmarketcapApi.Ticker{
  circulating_supply: 17035225,
  id: 1,
  last_updated: ~N[2018-05-15 17:44:33],
  max_supply: 21000000,
  name: "Bitcoin",
  quotes: %{
    "USD" => %CoinmarketcapApi.Quote{
      market_cap: 145773657018.0,
      percent_change_1h: -0.26,
      percent_change_24h: -2.54,
      percent_change_7d: -7.03,
      price: 8557.19,
      volume_24h: 6.69447e9
    }
  },
  rank: 1,
  symbol: "BTC",
  total_supply: 17035225,
  website_slug: "bitcoin"
}

Ticker values are parsed to the most fitting Elixir datatypes:

  • id -> Integer
  • last_updated -> NaiveDateTime
  • {total,circulating,max}_supply -> Integer

Listings

fetch_listings function returns all active cryptocurrency listings. You can then use fetch_ticker(id) to query more information for a specific cryptocurrency.

Global Data

fetch_global_data returns the global data found at the top of coinmarketcap.

Sort:  

Hello, could you point me to the right github repro? thanks

Sure, here it is -- repo link

Thank you for your contribution.

Your contribution has been evaluated according to Utopian rules and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post,Click here


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hey @ontofractal
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!