coinmarketcap-ruby-client 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c92b7dcc192e4c5124e62a64404cd9022047a2ef349face7b0231cefe95c9349
4
- data.tar.gz: ce068a4e060eeaf614d3d2908009e04efc54268e6189c83e3a975ead1eb20b7e
3
+ metadata.gz: 68d40da9940adeac22356bfb7718ea551f1426b1fe996e02fb68a4cf22bfc910
4
+ data.tar.gz: 2f7683d2f1df5368639f19daa3ad6f600fd95934a79e6e152ba9d521ae3850d0
5
5
  SHA512:
6
- metadata.gz: ad8cdadeef43edf7aeca19f9f5ed2cba0cf95f7571acb8e62bb2c594c79ebe1a04b2f88942350e42466ed5233ccca416c08a3851f1d0623ffef880d7b13a7f39
7
- data.tar.gz: 7fdc18918edec0df7c660315755bae5ae4ac7af49253c065bae9255780baa209534b4121bec1cd036666c893d4f7e8cc42dc13e9de1b1437332283b88f4f1154
6
+ metadata.gz: 9a74ffe20da317235779076674f053808e87f5b82ea3cbe278a76ce2746ee729fe042b67584681ed6968ac54a958563a30b49803dffa1b3cadc8e72c18c4ffc5
7
+ data.tar.gz: 8ce6b2e5f2b114ded37b9731d8d4bf4eb97708b8c22b0a1275ce67593911fc34b9d6409e1ac599ab3cd6869a592daa111af25cb120fbd5e4401dfd3bc17bc58a
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
- ### 1.1.1 (Next)
1
+ ### 1.1.2 (next)
2
2
 
3
3
  - your contributions here ...
4
4
 
5
+ ### 1.1.1 (2021/10/10)
6
+
7
+ - [#12](https://github.com/koffeefinance/coinmarketcap-ruby-client/pull/12): Added support to fetch latest quotes - [@mathu97](https://github.com/mathu97).
8
+
5
9
  ### 1.1.0 (2021/10/09)
6
10
 
7
11
  - [#5](https://github.com/koffeefinance/coinmarketcap-ruby-client/pull/5): Added support to fetch metadata for a cryptocurrency via the /info endpoint - [@mathu97](https://github.com/mathu97).
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coinmarketcap-ruby-client (1.1.0)
4
+ coinmarketcap-ruby-client (1.1.1)
5
5
  faraday (>= 1.8)
6
6
  faraday_middleware (>= 1.1)
7
7
  hashie
data/README.md CHANGED
@@ -13,6 +13,7 @@ A ruby API client for [CoinMarketCap](https://coinmarketcap.com/api/documentatio
13
13
  - [Get CoinMarketCap ID Map](#get-coinmarketcap-id-map)
14
14
  - [Get Cryptocurrency Metadata](#get-cryptocurrency-metadata)
15
15
  - [Get Latest Listings](#get-latest-listings)
16
+ - [Get Latest Quotes](#get-latest-quotes)
16
17
  - [Development](#development)
17
18
  - [Contributing](#contributing)
18
19
  - [License](#license)
@@ -150,6 +151,46 @@ Returns a paginated list of all active cryptocurrencies with latest market data.
150
151
 
151
152
  See [Listings Latest](https://coinmarketcap.com/api/documentation/v1/#operation/getV1CryptocurrencyListingsLatest) for detailed documentation.
152
153
 
154
+ ### Get Latest Quotes
155
+
156
+ Returns the latest market quote for 1 or more cryptocurrencies. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call.
157
+
158
+ ```ruby
159
+ listings = client.quotes_latest(symbol: 'BTC')
160
+ listing = listings['BTC']
161
+
162
+ listing.id # 1
163
+ listing.name # 'Bitcoin'
164
+ listing.symbol # 'BTC'
165
+ listing.slug # 'bitcoin'
166
+ listing.is_active # 1
167
+ listing.is_fiat # 0
168
+ listing.num_market_pairs # 8527
169
+ listing.date_added # <Date: 2013-04-28 ((2456411j,0s,0n),+0s,2299161j)>
170
+ listing.tags # ['mineable', 'pow', 'sha-256', 'store-of-value', ...]
171
+ listing.max_supply # 21000000
172
+ listing.circulating_supply # 18837706
173
+ listing.total_supply # 18837706
174
+ listing.platform # nil
175
+ listing.cmc_rank # 1
176
+ listing.last_updated # <Date: 2021-10-08 ((2459496j,0s,0n),+0s,2299161j)>
177
+
178
+ quote_in_usd = listing.quote['USD']
179
+
180
+ quote_in_usd.price # 53853.84605722145
181
+ quote_in_usd.volume_24h # 35664606394.86121
182
+ quote_in_usd.percent_change_1h # -0.08049597
183
+ quote_in_usd.percent_change_24h # -1.93058
184
+ quote_in_usd.percent_change_7d # 23.57830268
185
+ quote_in_usd.percent_change_30d # 15.8506565
186
+ quote_in_usd.percent_change_60d # 24.08594399
187
+ quote_in_usd.percent_change_90d # 59.25745607
188
+ quote_in_usd.market_cap # 1014482918995.1969
189
+ quote_in_usd.market_cap_dominance # 44.5955
190
+ quote_in_usd.fully_diluted_market_cap # 1130930767201.65
191
+ quote_in_usd.last_updated # <Date: 2021-10-08 ((2459496j,0s,0n),+0s,2299161j)>
192
+ ```
193
+
153
194
  ## Development
154
195
 
155
196
  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.
@@ -17,6 +17,13 @@ module CoinMarketCap
17
17
  response = get('cryptocurrency/listings/latest', options)
18
18
  response['data'].map { |row| CoinMarketCap::Resources::Listing.new(row) }
19
19
  end
20
+
21
+ def quotes_latest(options = {})
22
+ response = get('cryptocurrency/quotes/latest', options)
23
+ response['data'].map do |key, value|
24
+ [key, CoinMarketCap::Resources::Listing.new(value)]
25
+ end.to_h
26
+ end
20
27
  end
21
28
  end
22
29
  end
@@ -5,6 +5,8 @@ module CoinMarketCap
5
5
  property 'name'
6
6
  property 'symbol'
7
7
  property 'slug'
8
+ property 'is_active'
9
+ property 'is_fiat'
8
10
  property 'cmc_rank'
9
11
  property 'num_market_pairs'
10
12
  property 'circulating_supply'
@@ -1,3 +1,3 @@
1
1
  module CoinMarketCap
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coinmarketcap-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathusan Selvarajah