cryptocompare 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +177 -119
- data/lib/cryptocompare.rb +1 -0
- data/lib/cryptocompare/coin_list.rb +76 -0
- data/lib/cryptocompare/coin_snapshot.rb +43 -43
- data/lib/cryptocompare/histo_day.rb +24 -24
- data/lib/cryptocompare/histo_hour.rb +24 -24
- data/lib/cryptocompare/histo_minute.rb +24 -24
- data/lib/cryptocompare/price.rb +38 -38
- data/lib/cryptocompare/top_pairs.rb +12 -12
- data/lib/cryptocompare/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd4320f3979560ae4c08a6f8abf95627c495a1be
|
4
|
+
data.tar.gz: 5837a3365785a0ef52c7eebb2d115812351f0712
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aa4d3f5a38c53f0a39ca3a7fe10d7db19c0114b27d6cc909a13919588fa3d55dcdb9c0891d331ac3efe16b09488620c4c0315af969304e20c6671ce5c087bec
|
7
|
+
data.tar.gz: 25edeb8e6cac2d810509144ccbb56daba584f7f5cd031e66343c16dba088f0e3c5b4db7721aa15cea5c580b5bdbd771aa96ea33e8abc8d0d374b875dffa7258d
|
data/README.md
CHANGED
@@ -146,42 +146,42 @@ Generate average price for cryptocurrency to fiat currency.
|
|
146
146
|
```ruby
|
147
147
|
Cryptocompare::Price.generate_avg('BTC', 'USD', ['Coinbase', 'Bitfinex'])
|
148
148
|
# => {
|
149
|
-
# RAW
|
150
|
-
# MARKET
|
151
|
-
# FROMSYMBOL
|
152
|
-
# TOSYMBOL
|
153
|
-
# FLAGS
|
154
|
-
# PRICE
|
155
|
-
# LASTUPDATE
|
156
|
-
# LASTVOLUME
|
157
|
-
# LASTVOLUMETO
|
158
|
-
# LASTTRADEID
|
159
|
-
# VOLUME24HOUR
|
160
|
-
# VOLUME24HOURTO
|
161
|
-
# OPEN24HOUR
|
162
|
-
# HIGH24HOUR
|
163
|
-
# LOW24HOUR
|
164
|
-
# LASTMARKET
|
165
|
-
# CHANGE24HOUR
|
166
|
-
# CHANGEPCT24HOUR
|
149
|
+
# "RAW" => {
|
150
|
+
# "MARKET" => "CUSTOMAGG",
|
151
|
+
# "FROMSYMBOL" => "BTC",
|
152
|
+
# "TOSYMBOL" => "USD",
|
153
|
+
# "FLAGS" => 0,
|
154
|
+
# "PRICE" => 4137.43,
|
155
|
+
# "LASTUPDATE" => 1503454563,
|
156
|
+
# "LASTVOLUME" => 2,
|
157
|
+
# "LASTVOLUMETO" => 8271.98,
|
158
|
+
# "LASTTRADEID" => 19656029,
|
159
|
+
# "VOLUME24HOUR" => 71728.71957884016,
|
160
|
+
# "VOLUME24HOURTO" => 279374718.3442189,
|
161
|
+
# "OPEN24HOUR" => 3885.85,
|
162
|
+
# "HIGH24HOUR" => 4145,
|
163
|
+
# "LOW24HOUR" => 3583.46,
|
164
|
+
# "LASTMARKET" => "Coinbase",
|
165
|
+
# "CHANGE24HOUR" => 251.58000000000038,
|
166
|
+
# "CHANGEPCT24HOUR" => 6.474259171095137
|
167
167
|
# },
|
168
|
-
# DISPLAY
|
169
|
-
# FROMSYMBOL
|
170
|
-
# TOSYMBOL
|
171
|
-
# MARKET
|
172
|
-
# PRICE
|
173
|
-
# LASTUPDATE
|
174
|
-
# LASTVOLUME
|
175
|
-
# LASTVOLUMETO
|
176
|
-
# LASTTRADEID
|
177
|
-
# VOLUME24HOUR
|
178
|
-
# VOLUME24HOURTO
|
179
|
-
# OPEN24HOUR
|
180
|
-
# HIGH24HOUR
|
181
|
-
# LOW24HOUR
|
182
|
-
# LASTMARKET
|
183
|
-
# CHANGE24HOUR
|
184
|
-
# CHANGEPCT24HOUR
|
168
|
+
# "DISPLAY" => {
|
169
|
+
# "FROMSYMBOL" => "Ƀ",
|
170
|
+
# "TOSYMBOL" => "$",
|
171
|
+
# "MARKET" => "CUSTOMAGG",
|
172
|
+
# "PRICE" => "$ 4,137.43",
|
173
|
+
# "LASTUPDATE" => "Just now",
|
174
|
+
# "LASTVOLUME" => "Ƀ 2",
|
175
|
+
# "LASTVOLUMETO" => "$ 8,271.98",
|
176
|
+
# "LASTTRADEID" => 19656029,
|
177
|
+
# "VOLUME24HOUR" => "Ƀ 71,728.7",
|
178
|
+
# "VOLUME24HOURTO" => "$ 279,374,718.3",
|
179
|
+
# "OPEN24HOUR" => "$ 3,885.85",
|
180
|
+
# "HIGH24HOUR" => "$ 4,145",
|
181
|
+
# "LOW24HOUR" => "$ 3,583.46",
|
182
|
+
# "LASTMARKET" => "Coinbase",
|
183
|
+
# "CHANGE24HOUR" => "$ 251.58",
|
184
|
+
# "CHANGEPCT24HOUR" => "6.47"
|
185
185
|
# }
|
186
186
|
# }
|
187
187
|
```
|
@@ -226,6 +226,64 @@ Cryptocompare::PriceHistorical.find('ETH', ['BTC', 'USD', 'EUR'], {'ts' => '1452
|
|
226
226
|
# => {"ETH"=>{"BTC"=>0.08006, "USD"=>225.93, "EUR"=>194.24}}
|
227
227
|
```
|
228
228
|
|
229
|
+
### CoinList
|
230
|
+
|
231
|
+
Get general info for all the coins available on Cryptocompare's API.
|
232
|
+
|
233
|
+
**Example:**
|
234
|
+
|
235
|
+
```ruby
|
236
|
+
Cryptocompare::CoinList.all
|
237
|
+
# => {
|
238
|
+
# "Response" => "Success",
|
239
|
+
# "Message" => "Coin list succesfully returned!",
|
240
|
+
# "BaseImageUrl" => "https://www.cryptocompare.com",
|
241
|
+
# "BaseLinkUrl" => "https://www.cryptocompare.com",
|
242
|
+
# "DefaultWatchlist" => {
|
243
|
+
# "CoinIs" => "1182,7605,5038,24854,3807,3808,202330,5324,5031,20131",
|
244
|
+
# "Sponsored" => ""
|
245
|
+
# },
|
246
|
+
# "Data" => {
|
247
|
+
# "BTC" => {
|
248
|
+
# "Id" => "1182",
|
249
|
+
# "Url" => "/coins/btc/overview",
|
250
|
+
# "ImageUrl" => "/media/19633/btc.png",
|
251
|
+
# "Name" => "BTC",
|
252
|
+
# "Symbol" => "BTC",
|
253
|
+
# "CoinName" => "Bitcoin",
|
254
|
+
# "FullName" => "Bitcoin (BTC)",
|
255
|
+
# "Algorithm" => "SHA256",
|
256
|
+
# "ProofType" => "PoW",
|
257
|
+
# "FullyPremined" => "0",
|
258
|
+
# "TotalCoinSupply" => "21000000",
|
259
|
+
# "PreMinedValue" => "N/A",
|
260
|
+
# "TotalCoinsFreeFloat" => "N/A",
|
261
|
+
# "SortOrder" => "1",
|
262
|
+
# "Sponsored" => false
|
263
|
+
# },
|
264
|
+
# "ETH" => {
|
265
|
+
# "Id" => "7605",
|
266
|
+
# "Url" => "/coins/eth/overview",
|
267
|
+
# "ImageUrl" => "/media/20646/eth_logo.png",
|
268
|
+
# "Name" => "ETH",
|
269
|
+
# "Symbol" => "ETH",
|
270
|
+
# "CoinName" => "Ethereum ",
|
271
|
+
# "FullName" => "Ethereum (ETH)",
|
272
|
+
# "Algorithm" => "Ethash",
|
273
|
+
# "ProofType" => "PoW",
|
274
|
+
# "FullyPremined" => "0",
|
275
|
+
# "TotalCoinSupply" => "0",
|
276
|
+
# "PreMinedValue" => "N/A",
|
277
|
+
# "TotalCoinsFreeFloat" => "N/A",
|
278
|
+
# "SortOrder" => "2",
|
279
|
+
# "Sponsored" => false
|
280
|
+
# },
|
281
|
+
# ...
|
282
|
+
# },
|
283
|
+
# "Type" => 100
|
284
|
+
# }
|
285
|
+
```
|
286
|
+
|
229
287
|
### CoinSnapshot
|
230
288
|
|
231
289
|
Get data for a currency pair. It returns general block explorer information, aggregated data and individual data for each exchange available.
|
@@ -298,21 +356,21 @@ Find top pairs by trading volume for a given currency.
|
|
298
356
|
```ruby
|
299
357
|
Cryptocompare::TopPairs.find('ETH')
|
300
358
|
# => {
|
301
|
-
# Response
|
302
|
-
# Data
|
359
|
+
# "Response" => "Success",
|
360
|
+
# "Data" => [
|
303
361
|
# {
|
304
|
-
# exchange
|
305
|
-
# fromSymbol
|
306
|
-
# toSymbol
|
307
|
-
# volume24h
|
308
|
-
# volume24hTo
|
362
|
+
# "exchange" => "CCCAGG",
|
363
|
+
# "fromSymbol" => "ETH",
|
364
|
+
# "toSymbol" => "USD",
|
365
|
+
# "volume24h" => 1310705.3005027298,
|
366
|
+
# "volume24hTo" => 288031723.3503975
|
309
367
|
# },
|
310
368
|
# {
|
311
|
-
# exchange
|
312
|
-
# fromSymbol
|
313
|
-
# toSymbol
|
314
|
-
# volume24h
|
315
|
-
# volume24hTo
|
369
|
+
# "exchange" => "CCCAGG",
|
370
|
+
# "fromSymbol" => "ETH",
|
371
|
+
# "toSymbol" => "BTC",
|
372
|
+
# "volume24h" => 978200.2198323006,
|
373
|
+
# "volume24hTo" => 77883.06190085363
|
316
374
|
# },
|
317
375
|
# ...
|
318
376
|
# ]
|
@@ -330,36 +388,36 @@ Find historical data by minute for BTC to USD.
|
|
330
388
|
```ruby
|
331
389
|
Cryptocompare::HistoMinute.find('BTC', 'USD')
|
332
390
|
# => {
|
333
|
-
# Response
|
334
|
-
# Type
|
335
|
-
# Aggregated
|
336
|
-
# Data
|
391
|
+
# "Response" => "Success",
|
392
|
+
# "Type" => 100,
|
393
|
+
# "Aggregated" => true,
|
394
|
+
# "Data" => [
|
337
395
|
# {
|
338
|
-
# time
|
339
|
-
# close
|
340
|
-
# high
|
341
|
-
# low
|
342
|
-
# open
|
343
|
-
# volumefrom
|
344
|
-
# volumeto
|
396
|
+
# "time" => 1502259120,
|
397
|
+
# "close" => 3396.44,
|
398
|
+
# "high" => 3397.63,
|
399
|
+
# "low" => 3396.34,
|
400
|
+
# "open" => 3397.39,
|
401
|
+
# "volumefrom" => 98.2,
|
402
|
+
# "volumeto" => 335485
|
345
403
|
# },
|
346
404
|
# {
|
347
|
-
# time
|
348
|
-
# close
|
349
|
-
# high
|
350
|
-
# low
|
351
|
-
# open
|
352
|
-
# volumefrom
|
353
|
-
# volumeto
|
405
|
+
# "time" => 1502259300,
|
406
|
+
# "close" => 3396.86,
|
407
|
+
# "high" => 3396.94,
|
408
|
+
# "low" => 3396.44,
|
409
|
+
# "open" => 3396.44,
|
410
|
+
# "volumefrom" => 16.581031,
|
411
|
+
# "volumeto" => 56637.869999999995
|
354
412
|
# },
|
355
413
|
# ...
|
356
414
|
# ],
|
357
|
-
# TimeTo
|
358
|
-
# TimeFrom
|
359
|
-
# FirstValueInArray
|
360
|
-
# ConversionType
|
361
|
-
# type
|
362
|
-
# conversionSymbol
|
415
|
+
# "TimeTo" => 1502259360,
|
416
|
+
# "TimeFrom" => 1502259120,
|
417
|
+
# "FirstValueInArray" => true,
|
418
|
+
# "ConversionType" => {
|
419
|
+
# "type" => "direct",
|
420
|
+
# "conversionSymbol" => ""
|
363
421
|
# }
|
364
422
|
# }
|
365
423
|
```
|
@@ -375,36 +433,36 @@ Find historical data by hour for BTC to USD.
|
|
375
433
|
```ruby
|
376
434
|
Cryptocompare::HistoHour.find('BTC', 'USD')
|
377
435
|
# => {
|
378
|
-
# Response
|
379
|
-
# Type
|
380
|
-
# Aggregated
|
381
|
-
# Data
|
436
|
+
# "Response" => "Success",
|
437
|
+
# "Type" => 100,
|
438
|
+
# "Aggregated" => false,
|
439
|
+
# "Data" => [
|
382
440
|
# {
|
383
|
-
# time
|
384
|
-
# close
|
385
|
-
# high
|
386
|
-
# low
|
387
|
-
# open
|
388
|
-
# volumefrom
|
389
|
-
# volumeto
|
441
|
+
# "time" => 1502259120,
|
442
|
+
# "close" => 3396.44,
|
443
|
+
# "high" => 3397.63,
|
444
|
+
# "low" => 3396.34,
|
445
|
+
# "open" => 3397.39,
|
446
|
+
# "volumefrom" => 98.2,
|
447
|
+
# "volumeto" => 335485
|
390
448
|
# },
|
391
449
|
# {
|
392
|
-
# time
|
393
|
-
# close
|
394
|
-
# high
|
395
|
-
# low
|
396
|
-
# open
|
397
|
-
# volumefrom
|
398
|
-
# volumeto
|
450
|
+
# "time" => 1502259300,
|
451
|
+
# "close" => 3396.86,
|
452
|
+
# "high" => 3396.94,
|
453
|
+
# "low" => 3396.44,
|
454
|
+
# "open" => 3396.44,
|
455
|
+
# "volumefrom" => 16.581031,
|
456
|
+
# "volumeto" => 56637.869999999995
|
399
457
|
# },
|
400
458
|
# ...
|
401
459
|
# ],
|
402
|
-
# TimeTo
|
403
|
-
# TimeFrom
|
404
|
-
# FirstValueInArray
|
405
|
-
# ConversionType
|
406
|
-
# type
|
407
|
-
# conversionSymbol
|
460
|
+
# "TimeTo" => 1503248400,
|
461
|
+
# "TimeFrom" => 1502643600,
|
462
|
+
# "FirstValueInArray" => true,
|
463
|
+
# "ConversionType" => {
|
464
|
+
# "type" => "direct",
|
465
|
+
# "conversionSymbol" => ""
|
408
466
|
# }
|
409
467
|
# }
|
410
468
|
```
|
@@ -420,36 +478,36 @@ Find historical data by day for BTC to USD.
|
|
420
478
|
```ruby
|
421
479
|
Cryptocompare::HistoDay.find('BTC', 'USD')
|
422
480
|
# => {
|
423
|
-
# Response
|
424
|
-
# Type
|
425
|
-
# Aggregated
|
426
|
-
# Data
|
481
|
+
# "Response" => "Success",
|
482
|
+
# "Type" => 100,
|
483
|
+
# "Aggregated" => false,
|
484
|
+
# "Data" => [
|
427
485
|
# {
|
428
|
-
# time
|
429
|
-
# close
|
430
|
-
# high
|
431
|
-
# low
|
432
|
-
# open
|
433
|
-
# volumefrom
|
434
|
-
# volumeto
|
486
|
+
# "time" => 1500854400,
|
487
|
+
# "close" => 2763.42,
|
488
|
+
# "high" => 2798.89,
|
489
|
+
# "low" => 2715.69,
|
490
|
+
# "open" => 2756.61,
|
491
|
+
# "volumefrom" => 83009.25,
|
492
|
+
# "volumeto" => 229047365.02
|
435
493
|
# },
|
436
494
|
# {
|
437
|
-
# time
|
438
|
-
# close
|
439
|
-
# high
|
440
|
-
# low
|
441
|
-
# open
|
442
|
-
# volumefrom
|
443
|
-
# volumeto
|
495
|
+
# "time" => 1500940800,
|
496
|
+
# "close" => 2582.58,
|
497
|
+
# "high" => 2779.08,
|
498
|
+
# "low" => 2472.62,
|
499
|
+
# "open" => 2763.42,
|
500
|
+
# "volumefrom" => 205883.15,
|
501
|
+
# "volumeto" => 534765380.75
|
444
502
|
# },
|
445
503
|
# ...
|
446
504
|
# ],
|
447
|
-
# TimeTo
|
448
|
-
# TimeFrom
|
449
|
-
# FirstValueInArray
|
450
|
-
# ConversionType
|
451
|
-
# type
|
452
|
-
# conversionSymbol
|
505
|
+
# "TimeTo" => 1503446400,
|
506
|
+
# "TimeFrom" => 1500854400,
|
507
|
+
# "FirstValueInArray" => true,
|
508
|
+
# "ConversionType" => {
|
509
|
+
# "type" => "direct",
|
510
|
+
# "conversionSymbol" => ""
|
453
511
|
# }
|
454
512
|
# }
|
455
513
|
```
|
data/lib/cryptocompare.rb
CHANGED
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Cryptocompare
|
5
|
+
module CoinList
|
6
|
+
API_URL = 'https://min-api.cryptocompare.com/data/all/coinlist'
|
7
|
+
|
8
|
+
# Get general info for all the coins available on Cryptocompare's API.
|
9
|
+
#
|
10
|
+
# ==== Returns
|
11
|
+
#
|
12
|
+
# [Hash] Hash with data Data key which is a hash where coin symbols are the
|
13
|
+
# keys and each coin object cointains metadata about each coin.
|
14
|
+
#
|
15
|
+
# ==== Example
|
16
|
+
#
|
17
|
+
# Get all coins supported by Cryptocompare's API.
|
18
|
+
#
|
19
|
+
# Cryptocompare::CoinList.all
|
20
|
+
#
|
21
|
+
# Sample response
|
22
|
+
#
|
23
|
+
# {
|
24
|
+
# "Response" => "Success",
|
25
|
+
# "Message" => "Coin list succesfully returned!",
|
26
|
+
# "BaseImageUrl" => "https://www.cryptocompare.com",
|
27
|
+
# "BaseLinkUrl" => "https://www.cryptocompare.com",
|
28
|
+
# "DefaultWatchlist" => {
|
29
|
+
# "CoinIs" => "1182,7605,5038,24854,3807,3808,202330,5324,5031,20131",
|
30
|
+
# "Sponsored" => ""
|
31
|
+
# },
|
32
|
+
# "Data" => {
|
33
|
+
# "BTC" => {
|
34
|
+
# "Id" => "1182",
|
35
|
+
# "Url" => "/coins/btc/overview",
|
36
|
+
# "ImageUrl" => "/media/19633/btc.png",
|
37
|
+
# "Name" => "BTC",
|
38
|
+
# "Symbol" => "BTC",
|
39
|
+
# "CoinName" => "Bitcoin",
|
40
|
+
# "FullName" => "Bitcoin (BTC)",
|
41
|
+
# "Algorithm" => "SHA256",
|
42
|
+
# "ProofType" => "PoW",
|
43
|
+
# "FullyPremined" => "0",
|
44
|
+
# "TotalCoinSupply" => "21000000",
|
45
|
+
# "PreMinedValue" => "N/A",
|
46
|
+
# "TotalCoinsFreeFloat" => "N/A",
|
47
|
+
# "SortOrder" => "1",
|
48
|
+
# "Sponsored" => false
|
49
|
+
# },
|
50
|
+
# "ETH" => {
|
51
|
+
# "Id" => "7605",
|
52
|
+
# "Url" => "/coins/eth/overview",
|
53
|
+
# "ImageUrl" => "/media/20646/eth_logo.png",
|
54
|
+
# "Name" => "ETH",
|
55
|
+
# "Symbol" => "ETH",
|
56
|
+
# "CoinName" => "Ethereum ",
|
57
|
+
# "FullName" => "Ethereum (ETH)",
|
58
|
+
# "Algorithm" => "Ethash",
|
59
|
+
# "ProofType" => "PoW",
|
60
|
+
# "FullyPremined" => "0",
|
61
|
+
# "TotalCoinSupply" => "0",
|
62
|
+
# "PreMinedValue" => "N/A",
|
63
|
+
# "TotalCoinsFreeFloat" => "N/A",
|
64
|
+
# "SortOrder" => "2",
|
65
|
+
# "Sponsored" => false
|
66
|
+
# },
|
67
|
+
# ...
|
68
|
+
# },
|
69
|
+
# "Type" => 100
|
70
|
+
# }
|
71
|
+
def self.all
|
72
|
+
api_resp = Faraday.get(API_URL)
|
73
|
+
JSON.parse(api_resp.body)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -27,51 +27,51 @@ module Cryptocompare
|
|
27
27
|
# Sample response
|
28
28
|
#
|
29
29
|
# {
|
30
|
-
# "Response"
|
31
|
-
# "Message"
|
32
|
-
# "Type"
|
33
|
-
# "Data"
|
34
|
-
# "Algorithm"
|
35
|
-
# "ProofType"
|
36
|
-
# "BlockNumber"
|
37
|
-
# "NetHashesPerSecond"
|
38
|
-
# "TotalCoinsMined"
|
39
|
-
# "BlockReward"
|
40
|
-
# "AggregatedData"
|
41
|
-
# "TYPE"
|
42
|
-
# "MARKET"
|
43
|
-
# "FROMSYMBOL"
|
44
|
-
# "TOSYMBOL"
|
45
|
-
# "FLAGS"
|
46
|
-
# "PRICE"
|
47
|
-
# "LASTUPDATE"
|
48
|
-
# "LASTVOLUME"
|
49
|
-
# "LASTVOLUMETO"
|
50
|
-
# "LASTTRADEID"
|
51
|
-
# "VOLUME24HOUR"
|
52
|
-
# "VOLUME24HOURTO"
|
53
|
-
# "OPEN24HOUR"
|
54
|
-
# "HIGH24HOUR"
|
55
|
-
# "LOW24HOUR"
|
56
|
-
# "LASTMARKET"
|
30
|
+
# "Response" => "Success",
|
31
|
+
# "Message" => "Coin snapshot succesfully returned",
|
32
|
+
# "Type" => 100,
|
33
|
+
# "Data" => {
|
34
|
+
# "Algorithm" => "SHA256",
|
35
|
+
# "ProofType" => "PoW",
|
36
|
+
# "BlockNumber" => 378345,
|
37
|
+
# "NetHashesPerSecond" => 465548431.66333866,
|
38
|
+
# "TotalCoinsMined" => 14707625.0,
|
39
|
+
# "BlockReward" => 25.0,
|
40
|
+
# "AggregatedData" => {
|
41
|
+
# "TYPE" => "5",
|
42
|
+
# "MARKET" => "CCCAGG",
|
43
|
+
# "FROMSYMBOL" => "BTC",
|
44
|
+
# "TOSYMBOL" => "USD",
|
45
|
+
# "FLAGS" => "4",
|
46
|
+
# "PRICE" => "245.41",
|
47
|
+
# "LASTUPDATE" => "1444520460",
|
48
|
+
# "LASTVOLUME" => "0.0086",
|
49
|
+
# "LASTVOLUMETO" => "2.110268",
|
50
|
+
# "LASTTRADEID" => "1444520460357",
|
51
|
+
# "VOLUME24HOUR" => "49591.48108707269",
|
52
|
+
# "VOLUME24HOURTO" => "12139110.189163648",
|
53
|
+
# "OPEN24HOUR" => "244.41",
|
54
|
+
# "HIGH24HOUR" => "258.37",
|
55
|
+
# "LOW24HOUR" => "239.01000004",
|
56
|
+
# "LASTMARKET" => "Huobi"
|
57
57
|
# },
|
58
|
-
# "Exchanges"
|
58
|
+
# "Exchanges" => [
|
59
59
|
# {
|
60
|
-
# "TYPE"
|
61
|
-
# "MARKET"
|
62
|
-
# "FROMSYMBOL"
|
63
|
-
# "TOSYMBOL"
|
64
|
-
# "FLAGS"
|
65
|
-
# "PRICE"
|
66
|
-
# "LASTUPDATE"
|
67
|
-
# "LASTVOLUME"
|
68
|
-
# "LASTVOLUMETO"
|
69
|
-
# "LASTTRADEID"
|
70
|
-
# "VOLUME24HOUR"
|
71
|
-
# "VOLUME24HOURTO"
|
72
|
-
# "OPEN24HOUR"
|
73
|
-
# "HIGH24HOUR"
|
74
|
-
# "LOW24HOUR"
|
60
|
+
# "TYPE" => "2",
|
61
|
+
# "MARKET" => "LakeBTC",
|
62
|
+
# "FROMSYMBOL" => "BTC",
|
63
|
+
# "TOSYMBOL" => "USD",
|
64
|
+
# "FLAGS" => "2",
|
65
|
+
# "PRICE" => "244.37",
|
66
|
+
# "LASTUPDATE" => "1444513131",
|
67
|
+
# "LASTVOLUME" => "0.03",
|
68
|
+
# "LASTVOLUMETO" => "7.3311",
|
69
|
+
# "LASTTRADEID" => "1444513131",
|
70
|
+
# "VOLUME24HOUR" => "3599.0560000000005",
|
71
|
+
# "VOLUME24HOURTO" => "879237.6299349999",
|
72
|
+
# "OPEN24HOUR" => "243.83",
|
73
|
+
# "HIGH24HOUR" => "245.23",
|
74
|
+
# "LOW24HOUR" => "242.68"
|
75
75
|
# },
|
76
76
|
# ....
|
77
77
|
# ]
|
@@ -37,36 +37,36 @@ module Cryptocompare
|
|
37
37
|
# Sample response
|
38
38
|
#
|
39
39
|
# {
|
40
|
-
# Response
|
41
|
-
# Type
|
42
|
-
# Aggregated
|
43
|
-
# Data
|
40
|
+
# "Response" => "Success",
|
41
|
+
# "Type" => 100,
|
42
|
+
# "Aggregated" => false,
|
43
|
+
# "Data" => [
|
44
44
|
# {
|
45
|
-
# time
|
46
|
-
# close
|
47
|
-
# high
|
48
|
-
# low
|
49
|
-
# open
|
50
|
-
# volumefrom
|
51
|
-
# volumeto
|
45
|
+
# "time" => 1500854400,
|
46
|
+
# "close" => 2763.42,
|
47
|
+
# "high" => 2798.89,
|
48
|
+
# "low" => 2715.69,
|
49
|
+
# "open" => 2756.61,
|
50
|
+
# "volumefrom" => 83009.25,
|
51
|
+
# "volumeto" => 229047365.02
|
52
52
|
# },
|
53
53
|
# {
|
54
|
-
# time
|
55
|
-
# close
|
56
|
-
# high
|
57
|
-
# low
|
58
|
-
# open
|
59
|
-
# volumefrom
|
60
|
-
# volumeto
|
54
|
+
# "time" => 1500940800,
|
55
|
+
# "close" => 2582.58,
|
56
|
+
# "high" => 2779.08,
|
57
|
+
# "low" => 2472.62,
|
58
|
+
# "open" => 2763.42,
|
59
|
+
# "volumefrom" => 205883.15,
|
60
|
+
# "volumeto" => 534765380.75
|
61
61
|
# },
|
62
62
|
# ...
|
63
63
|
# ],
|
64
|
-
# TimeTo
|
65
|
-
# TimeFrom
|
66
|
-
# FirstValueInArray
|
67
|
-
# ConversionType
|
68
|
-
# type
|
69
|
-
# conversionSymbol
|
64
|
+
# "TimeTo" => 1503446400,
|
65
|
+
# "TimeFrom" => 1500854400,
|
66
|
+
# "FirstValueInArray" => true,
|
67
|
+
# "ConversionType" => {
|
68
|
+
# "type" => "direct",
|
69
|
+
# "conversionSymbol" => ""
|
70
70
|
# }
|
71
71
|
# }
|
72
72
|
def self.find(from_sym, to_sym, opts = {})
|
@@ -36,36 +36,36 @@ module Cryptocompare
|
|
36
36
|
# Sample response
|
37
37
|
#
|
38
38
|
# {
|
39
|
-
# Response
|
40
|
-
# Type
|
41
|
-
# Aggregated
|
42
|
-
# Data
|
39
|
+
# "Response" => "Success",
|
40
|
+
# "Type" => 100,
|
41
|
+
# "Aggregated" => false,
|
42
|
+
# "Data" => [
|
43
43
|
# {
|
44
|
-
# time
|
45
|
-
# close
|
46
|
-
# high
|
47
|
-
# low
|
48
|
-
# open
|
49
|
-
# volumefrom
|
50
|
-
# volumeto
|
44
|
+
# "time" => 1502643600,
|
45
|
+
# "close" => 3998.47,
|
46
|
+
# "high" => 4069.8,
|
47
|
+
# "low" => 3982.5,
|
48
|
+
# "open" => 4059.28,
|
49
|
+
# "volumefrom" => 5087.23,
|
50
|
+
# "volumeto" => 20453919.02
|
51
51
|
# },
|
52
52
|
# {
|
53
|
-
# time
|
54
|
-
# close
|
55
|
-
# high
|
56
|
-
# low
|
57
|
-
# open
|
58
|
-
# volumefrom
|
59
|
-
# volumeto
|
53
|
+
# "time" => 1502647200,
|
54
|
+
# "close" => 4061.5,
|
55
|
+
# "high" => 4074.57,
|
56
|
+
# "low" => 3998.47,
|
57
|
+
# "open" => 3998.47,
|
58
|
+
# "volumefrom" => 3839.78,
|
59
|
+
# "volumeto" => 15606476.19
|
60
60
|
# },
|
61
61
|
# ...
|
62
62
|
# ],
|
63
|
-
# TimeTo
|
64
|
-
# TimeFrom
|
65
|
-
# FirstValueInArray
|
66
|
-
# ConversionType
|
67
|
-
# type
|
68
|
-
# conversionSymbol
|
63
|
+
# "TimeTo" => 1503248400,
|
64
|
+
# "TimeFrom" => 1502643600,
|
65
|
+
# "FirstValueInArray" => true,
|
66
|
+
# "ConversionType" => {
|
67
|
+
# "type" => "direct",
|
68
|
+
# "conversionSymbol" => ""
|
69
69
|
# }
|
70
70
|
# }
|
71
71
|
def self.find(from_sym, to_sym, opts = {})
|
@@ -39,36 +39,36 @@ module Cryptocompare
|
|
39
39
|
# Sample response
|
40
40
|
#
|
41
41
|
# {
|
42
|
-
# Response
|
43
|
-
# Type
|
44
|
-
# Aggregated
|
45
|
-
# Data
|
42
|
+
# "Response" => "Success",
|
43
|
+
# "Type" => 100,
|
44
|
+
# "Aggregated" => true,
|
45
|
+
# "Data" => [
|
46
46
|
# {
|
47
|
-
# time
|
48
|
-
# close
|
49
|
-
# high
|
50
|
-
# low
|
51
|
-
# open
|
52
|
-
# volumefrom
|
53
|
-
# volumeto
|
47
|
+
# "time" => 1502259120,
|
48
|
+
# "close" => 3396.44,
|
49
|
+
# "high" => 3397.63,
|
50
|
+
# "low" => 3396.34,
|
51
|
+
# "open" => 3397.39,
|
52
|
+
# "volumefrom" => 98.2,
|
53
|
+
# "volumeto" => 335485
|
54
54
|
# },
|
55
55
|
# {
|
56
|
-
# time
|
57
|
-
# close
|
58
|
-
# high
|
59
|
-
# low
|
60
|
-
# open
|
61
|
-
# volumefrom
|
62
|
-
# volumeto
|
56
|
+
# "time" => 1502259300,
|
57
|
+
# "close" => 3396.86,
|
58
|
+
# "high" => 3396.94,
|
59
|
+
# "low" => 3396.44,
|
60
|
+
# "open" => 3396.44,
|
61
|
+
# "volumefrom" => 16.581031,
|
62
|
+
# "volumeto" => 56637.869999999995
|
63
63
|
# },
|
64
64
|
# ...
|
65
65
|
# ],
|
66
|
-
# TimeTo
|
67
|
-
# TimeFrom
|
68
|
-
# FirstValueInArray
|
69
|
-
# ConversionType
|
70
|
-
# type
|
71
|
-
# conversionSymbol
|
66
|
+
# "TimeTo" => 1502259360,
|
67
|
+
# "TimeFrom" => 1502259120,
|
68
|
+
# "FirstValueInArray" => true,
|
69
|
+
# "ConversionType" => {
|
70
|
+
# "type" => "direct",
|
71
|
+
# "conversionSymbol" => ""
|
72
72
|
# }
|
73
73
|
# }
|
74
74
|
def self.find(from_sym, to_sym, opts = {})
|
data/lib/cryptocompare/price.rb
CHANGED
@@ -174,7 +174,7 @@ module Cryptocompare
|
|
174
174
|
#
|
175
175
|
# * +from_sym+ [String] - (required) currency symbols (ex: 'BTC', 'ETH', 'LTC', 'USD', 'EUR', 'CNY')
|
176
176
|
# * +to_sym+ [String] - (required) currency symbols (ex: 'USD', 'EUR', 'CNY', 'USD', 'EUR', 'CNY')
|
177
|
-
# * +
|
177
|
+
# * +e+ [String, Array] - (required) Name of exchanges. Supports multiple. (ex: 'Coinbase','Poloniex')
|
178
178
|
# * +opts+ [Hash] - (optional) options hash
|
179
179
|
#
|
180
180
|
# ==== Options
|
@@ -196,49 +196,49 @@ module Cryptocompare
|
|
196
196
|
# Sample response
|
197
197
|
#
|
198
198
|
# {
|
199
|
-
# RAW
|
200
|
-
# MARKET
|
201
|
-
# FROMSYMBOL
|
202
|
-
# TOSYMBOL
|
203
|
-
# FLAGS
|
204
|
-
# PRICE
|
205
|
-
# LASTUPDATE
|
206
|
-
# LASTVOLUME
|
207
|
-
# LASTVOLUMETO
|
208
|
-
# LASTTRADEID
|
209
|
-
# VOLUME24HOUR
|
210
|
-
# VOLUME24HOURTO
|
211
|
-
# OPEN24HOUR
|
212
|
-
# HIGH24HOUR
|
213
|
-
# LOW24HOUR
|
214
|
-
# LASTMARKET
|
215
|
-
# CHANGE24HOUR
|
216
|
-
# CHANGEPCT24HOUR
|
199
|
+
# "RAW" => {
|
200
|
+
# "MARKET" => "CUSTOMAGG",
|
201
|
+
# "FROMSYMBOL" => "BTC",
|
202
|
+
# "TOSYMBOL" => "USD",
|
203
|
+
# "FLAGS" => 0,
|
204
|
+
# "PRICE" => 4137.43,
|
205
|
+
# "LASTUPDATE" => 1503454563,
|
206
|
+
# "LASTVOLUME" => 2,
|
207
|
+
# "LASTVOLUMETO" => 8271.98,
|
208
|
+
# "LASTTRADEID" => 19656029,
|
209
|
+
# "VOLUME24HOUR" => 71728.71957884016,
|
210
|
+
# "VOLUME24HOURTO" => 279374718.3442189,
|
211
|
+
# "OPEN24HOUR" => 3885.85,
|
212
|
+
# "HIGH24HOUR" => 4145,
|
213
|
+
# "LOW24HOUR" => 3583.46,
|
214
|
+
# "LASTMARKET" => "Coinbase",
|
215
|
+
# "CHANGE24HOUR" => 251.58000000000038,
|
216
|
+
# "CHANGEPCT24HOUR" => 6.474259171095137
|
217
217
|
# },
|
218
|
-
# DISPLAY
|
219
|
-
# FROMSYMBOL
|
220
|
-
# TOSYMBOL
|
221
|
-
# MARKET
|
222
|
-
# PRICE
|
223
|
-
# LASTUPDATE
|
224
|
-
# LASTVOLUME
|
225
|
-
# LASTVOLUMETO
|
226
|
-
# LASTTRADEID
|
227
|
-
# VOLUME24HOUR
|
228
|
-
# VOLUME24HOURTO
|
229
|
-
# OPEN24HOUR
|
230
|
-
# HIGH24HOUR
|
231
|
-
# LOW24HOUR
|
232
|
-
# LASTMARKET
|
233
|
-
# CHANGE24HOUR
|
234
|
-
# CHANGEPCT24HOUR
|
218
|
+
# "DISPLAY" => {
|
219
|
+
# "FROMSYMBOL" => "Ƀ",
|
220
|
+
# "TOSYMBOL" => "$",
|
221
|
+
# "MARKET" => "CUSTOMAGG",
|
222
|
+
# "PRICE" => "$ 4,137.43",
|
223
|
+
# "LASTUPDATE" => "Just now",
|
224
|
+
# "LASTVOLUME" => "Ƀ 2",
|
225
|
+
# "LASTVOLUMETO" => "$ 8,271.98",
|
226
|
+
# "LASTTRADEID" => 19656029,
|
227
|
+
# "VOLUME24HOUR" => "Ƀ 71,728.7",
|
228
|
+
# "VOLUME24HOURTO" => "$ 279,374,718.3",
|
229
|
+
# "OPEN24HOUR" => "$ 3,885.85",
|
230
|
+
# "HIGH24HOUR" => "$ 4,145",
|
231
|
+
# "LOW24HOUR" => "$ 3,583.46",
|
232
|
+
# "LASTMARKET" => "Coinbase",
|
233
|
+
# "CHANGE24HOUR" => "$ 251.58",
|
234
|
+
# "CHANGEPCT24HOUR" => "6.47"
|
235
235
|
# }
|
236
236
|
# }
|
237
|
-
def self.generate_avg(from_sym, to_sym,
|
237
|
+
def self.generate_avg(from_sym, to_sym, e, opts = {})
|
238
238
|
params = {
|
239
239
|
'from_sym' => from_sym,
|
240
240
|
'to_sym' => to_sym,
|
241
|
-
'
|
241
|
+
'e' => Array(e).join(',')
|
242
242
|
}.merge!(opts)
|
243
243
|
|
244
244
|
full_path = QueryParamHelper.set_query_params(GENERATE_AVG_API_URL, params)
|
@@ -32,21 +32,21 @@ module Cryptocompare
|
|
32
32
|
# Sample response
|
33
33
|
#
|
34
34
|
# {
|
35
|
-
# Response
|
36
|
-
# Data
|
35
|
+
# "Response" => "Success",
|
36
|
+
# "Data" => [
|
37
37
|
# {
|
38
|
-
# exchange
|
39
|
-
# fromSymbol
|
40
|
-
# toSymbol
|
41
|
-
# volume24h
|
42
|
-
# volume24hTo
|
38
|
+
# "exchange" => "CCCAGG",
|
39
|
+
# "fromSymbol" => "ETH",
|
40
|
+
# "toSymbol" => "USD",
|
41
|
+
# "volume24h" => 1310705.3005027298,
|
42
|
+
# "volume24hTo" => 288031723.3503975
|
43
43
|
# },
|
44
44
|
# {
|
45
|
-
# exchange
|
46
|
-
# fromSymbol
|
47
|
-
# toSymbol
|
48
|
-
# volume24h
|
49
|
-
# volume24hTo
|
45
|
+
# "exchange" => "CCCAGG",
|
46
|
+
# "fromSymbol" => "ETH",
|
47
|
+
# "toSymbol" => "BTC",
|
48
|
+
# "volume24h" => 978200.2198323006,
|
49
|
+
# "volume24hTo" => 77883.06190085363
|
50
50
|
# },
|
51
51
|
# ...
|
52
52
|
# ]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptocompare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander David Pan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- config/query_param_mapping.yml
|
128
128
|
- cryptocompare.gemspec
|
129
129
|
- lib/cryptocompare.rb
|
130
|
+
- lib/cryptocompare/coin_list.rb
|
130
131
|
- lib/cryptocompare/coin_snapshot.rb
|
131
132
|
- lib/cryptocompare/helpers/query_param_helper.rb
|
132
133
|
- lib/cryptocompare/histo_day.rb
|