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 +4 -4
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/README.md +41 -0
- data/lib/coinmarketcap/endpoints/cryptocurrency.rb +7 -0
- data/lib/coinmarketcap/resources/listing.rb +2 -0
- data/lib/coinmarketcap/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68d40da9940adeac22356bfb7718ea551f1426b1fe996e02fb68a4cf22bfc910
|
4
|
+
data.tar.gz: 2f7683d2f1df5368639f19daa3ad6f600fd95934a79e6e152ba9d521ae3850d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a74ffe20da317235779076674f053808e87f5b82ea3cbe278a76ce2746ee729fe042b67584681ed6968ac54a958563a30b49803dffa1b3cadc8e72c18c4ffc5
|
7
|
+
data.tar.gz: 8ce6b2e5f2b114ded37b9731d8d4bf4eb97708b8c22b0a1275ce67593911fc34b9d6409e1ac599ab3cd6869a592daa111af25cb120fbd5e4401dfd3bc17bc58a
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
### 1.1.
|
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
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
|