README.md in coinmarketcap-ruby-client-1.0.0 vs README.md in coinmarketcap-ruby-client-1.1.0

- old
+ new

@@ -1,16 +1,20 @@ # CoinMarketCap Ruby API Client +[![Gem Version](https://badge.fury.io/rb/coinmarketcap-ruby-client.svg)](https://badge.fury.io/rb/coinmarketcap-ruby-client) ![Build Status](https://github.com/koffeefinance/coinmarketcap-ruby-client/actions/workflows/ruby.yml/badge.svg) + A ruby API client for [CoinMarketCap](https://coinmarketcap.com/api/documentation/v1/) # Table of Contents - [Installation](#installation) - [Usage](#usage) - [Get an API Key](#get-an-api-token) - [Configure](#configure) - [Get CoinMarketCap ID Map](#get-coinmarketcap-id-map) + - [Get Cryptocurrency Metadata](#get-cryptocurrency-metadata) + - [Get Latest Listings](#get-latest-listings) - [Development](#development) - [Contributing](#contributing) - [License](#license) - [Code of Conduct](#code-of-conduct) @@ -69,10 +73,83 @@ platform.symbol # 'ETH' platform.slug # 'ethereum' platform.token_address # '0xdac17f958d2ee523a2206206994597c13d831ec7' ``` -See [Cryptocurrency Map](https://coinmarketcap.com/api/documentation/v1/#operation/getV1CryptocurrencyMap) for detailed documentation. +See [CoinMarketCap ID Map](https://coinmarketcap.com/api/documentation/v1/#operation/getV1CryptocurrencyMap) for detailed documentation. + +### Get Cryptocurrency Metadata + +Fetches static metadata available for one or more cryptocurrencies. + +```ruby + info = client.info(symbol: 'ETH') + + metadata = info['ETH'] + metadata.id # 1027 + metadata.name # 'Ethereum' + metadata.symbol # 'ETH' + metadata.category # 'coin' + metadata.description # 'Ethereum (ETH) is a cryptocurrency . Users are able to generate ETH ...' + metadata.slug # 'ethereum' + metadata.logo # 'https://s2.coinmarketcap.com/static/img/coins/64x64/1027.png' + metadata.notice # '' + metadata.tags # ['mineable', 'pow', 'smart-contracts', ...] + metadata.platform # nil + + urls = metadata.urls + urls.website # ['https://www.ethereum.org/', 'https://en.wikipedia.org/wiki/Ethereum'] + urls.twitter # ['https://twitter.com/ethereum'] + urls.message_board # ['https://forum.ethereum.org/', 'https://ethresear.ch/'] + urls.chat # ['https://gitter.im/orgs/ethereum/rooms'] + urls.explorer # ['https://etherscan.io/', 'https://ethplorer.io/', 'https://blockchair.com/ethereum', ...] + urls.reddit # ['https://reddit.com/r/ethereum'] + urls.technical_doc # ['https://github.com/ethereum/wiki/wiki/White-Paper'] + urls.source_code # ['https://github.com/ethereum'] + urls.announcement # ['https://bitcointalk.org/index.php?topic=428589.0'] +``` + +See [Cryptocurrency Metadata](https://coinmarketcap.com/api/documentation/v1/#operation/getV1CryptocurrencyInfo) for detailed documentation. + +### Get Latest Listings + +Returns a paginated list of all active cryptocurrencies with latest market data. + +```ruby + listings = client.listings_latest + listing = listings.first + + listing.id # 1 + listing.name # 'Bitcoin' + listing.symbol # 'BTC' + listing.slug # 'bitcoin' + listing.num_market_pairs # 8527 + listing.date_added # <Date: 2013-04-28 ((2456411j,0s,0n),+0s,2299161j)> + listing.tags # ['mineable', 'pow', 'sha-256', 'store-of-value', ...] + listing.max_supply # 21000000 + listing.circulating_supply # 18837706 + listing.total_supply # 18837706 + listing.platform # nil + listing.cmc_rank # 1 + listing.last_updated # <Date: 2021-10-08 ((2459496j,0s,0n),+0s,2299161j)> + + quote_in_usd = listing.quote['USD'] + + quote_in_usd.price # 53853.84605722145 + quote_in_usd.volume_24h # 35664606394.86121 + quote_in_usd.percent_change_1h # -0.08049597 + quote_in_usd.percent_change_24h # -1.93058 + quote_in_usd.percent_change_7d # 23.57830268 + quote_in_usd.percent_change_30d # 15.8506565 + quote_in_usd.percent_change_60d # 24.08594399 + quote_in_usd.percent_change_90d # 59.25745607 + quote_in_usd.market_cap # 1014482918995.1969 + quote_in_usd.market_cap_dominance # 44.5955 + quote_in_usd.fully_diluted_market_cap # 1130930767201.65 + quote_in_usd.last_updated # <Date: 2021-10-08 ((2459496j,0s,0n),+0s,2299161j)> +``` + +See [Listings Latest](https://coinmarketcap.com/api/documentation/v1/#operation/getV1CryptocurrencyListingsLatest) for detailed documentation. ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.