cryptocompare 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +0 -6
- data/Gemfile +0 -5
- data/README.md +45 -0
- data/lib/cryptocompare.rb +1 -0
- data/lib/cryptocompare/histo_day.rb +83 -0
- 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: 3214abf1e4db6cdc7ad1b14fae33f48991f4b14c
|
4
|
+
data.tar.gz: 99daf1104f9a4e855d2972d50d735615d0f57b53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10a42fc41ffe732ba377ca3246e41730cfab7bb27ac56feb893520b7b5b6ae63cb9ed14f6d624a10022e42b93c1e8864a154065c5279af5707e37f06a33c85c2
|
7
|
+
data.tar.gz: 1fc267b87ab24e42c4fc657e5928aa09557c5774a195e91e4bda933dd82ceb758a8c54083997e2d6a85c0c939467f5afb11a746522c1abc70fdbd63095d7e51e
|
data/.travis.yml
CHANGED
@@ -3,9 +3,3 @@ language: ruby
|
|
3
3
|
rvm:
|
4
4
|
- 2.0.0
|
5
5
|
before_install: gem install bundler -v 1.12.5
|
6
|
-
addons:
|
7
|
-
code_climate:
|
8
|
-
repo_token: 69656235648d9fc861fdb7a11a06cf1481e3aae42c8381873f1b72341bdeac6c
|
9
|
-
# regular test configuration
|
10
|
-
after_success:
|
11
|
-
- bundle exec codeclimate-test-reporter
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -294,6 +294,51 @@ Cryptocompare::HistoHour.find('BTC', 'USD')
|
|
294
294
|
# }
|
295
295
|
```
|
296
296
|
|
297
|
+
### HistoDay
|
298
|
+
|
299
|
+
Get open, high, low, close, volumefrom and volumeto daily historical data. The values are based on 00:00 GMT time. It uses BTC conversion if data is not available because the coin is not trading in the specified currency.
|
300
|
+
|
301
|
+
**Examples:**
|
302
|
+
|
303
|
+
Find historical data by day for BTC to USD.
|
304
|
+
|
305
|
+
```ruby
|
306
|
+
Cryptocompare::HistoDay.find('BTC', 'USD')
|
307
|
+
# => {
|
308
|
+
# Response: "Success",
|
309
|
+
# Type: 100,
|
310
|
+
# Aggregated: false,
|
311
|
+
# Data: [
|
312
|
+
# {
|
313
|
+
# time: 1500854400,
|
314
|
+
# close: 2763.42,
|
315
|
+
# high: 2798.89,
|
316
|
+
# low: 2715.69,
|
317
|
+
# open: 2756.61,
|
318
|
+
# volumefrom: 83009.25,
|
319
|
+
# volumeto: 229047365.02
|
320
|
+
# },
|
321
|
+
# {
|
322
|
+
# time: 1500940800,
|
323
|
+
# close: 2582.58,
|
324
|
+
# high: 2779.08,
|
325
|
+
# low: 2472.62,
|
326
|
+
# open: 2763.42,
|
327
|
+
# volumefrom: 205883.15,
|
328
|
+
# volumeto: 534765380.75
|
329
|
+
# },
|
330
|
+
# ...
|
331
|
+
# ],
|
332
|
+
# TimeTo: 1503446400,
|
333
|
+
# TimeFrom: 1500854400,
|
334
|
+
# FirstValueInArray: true,
|
335
|
+
# ConversionType: {
|
336
|
+
# type: "direct",
|
337
|
+
# conversionSymbol: ""
|
338
|
+
# }
|
339
|
+
# }
|
340
|
+
```
|
341
|
+
|
297
342
|
## Supported Exchanges
|
298
343
|
|
299
344
|
* BTC38
|
data/lib/cryptocompare.rb
CHANGED
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Cryptocompare
|
5
|
+
module HistoDay
|
6
|
+
API_URL = 'https://min-api.cryptocompare.com/data/histoday'
|
7
|
+
|
8
|
+
# Get open, high, low, close, volumefrom and volumeto daily historical data.
|
9
|
+
# The values are based on 00:00 GMT time. It uses BTC conversion if data is
|
10
|
+
# not available because the coin is not trading in the specified currency.
|
11
|
+
#
|
12
|
+
# ==== Parameters
|
13
|
+
#
|
14
|
+
# * +from_sym+ [String] - (required) currency symbol (ex: 'BTC', 'ETH', 'LTC', 'USD', 'EUR', 'CNY')
|
15
|
+
# * +to_syms+ [String, Array] - (required) currency symbol(s) (ex: 'USD', 'EUR', 'CNY', 'USD', 'EUR', 'CNY')
|
16
|
+
# * +opts+ [Hash] - (optional) options hash
|
17
|
+
#
|
18
|
+
# ==== Options
|
19
|
+
#
|
20
|
+
# * +e+ [String] - (optional) name of exchange (ex: 'Coinbase','Poloniex') Default: CCCAGG.
|
21
|
+
# * +limit+ [Integer] - (optional) limit. Default 30. Max 2000. Must be positive integer. Returns limit + 1 data points.
|
22
|
+
# * +agg+ [Integer] - (optional) number of data points to aggregate. Default 1.
|
23
|
+
# * +to_ts+ [Integer] - (optional) timestamp. Use the timestamp option to set a historical start point. By default, it gets historical data for the past several days.
|
24
|
+
# * +tc+ [Boolean] - (optional) try conversion. Default true. If the crypto does not trade directly into the toSymbol requested, BTC will be used for conversion.
|
25
|
+
# * +all_data+ [Boolean] - (optional) all data. Default false. Returns all available data instead of limit.
|
26
|
+
#
|
27
|
+
# ==== Returns
|
28
|
+
#
|
29
|
+
# [Hash] Returns a hash containing data as an array of hashes containing
|
30
|
+
# info such as open, high, low, close, volumefrom and volumeto for
|
31
|
+
# each day.
|
32
|
+
#
|
33
|
+
# ==== Examples
|
34
|
+
#
|
35
|
+
# Cryptocompare::HistoDay.find('BTC', 'USD')
|
36
|
+
#
|
37
|
+
# Sample response
|
38
|
+
#
|
39
|
+
# {
|
40
|
+
# Response: "Success",
|
41
|
+
# Type: 100,
|
42
|
+
# Aggregated: false,
|
43
|
+
# Data: [
|
44
|
+
# {
|
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
|
+
# },
|
53
|
+
# {
|
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
|
+
# },
|
62
|
+
# ...
|
63
|
+
# ],
|
64
|
+
# TimeTo: 1503446400,
|
65
|
+
# TimeFrom: 1500854400,
|
66
|
+
# FirstValueInArray: true,
|
67
|
+
# ConversionType: {
|
68
|
+
# type: "direct",
|
69
|
+
# conversionSymbol: ""
|
70
|
+
# }
|
71
|
+
# }
|
72
|
+
def self.find(from_sym, to_sym, opts = {})
|
73
|
+
params = {
|
74
|
+
'from_sym' => from_sym,
|
75
|
+
'to_sym' => to_sym
|
76
|
+
}.merge!(opts)
|
77
|
+
|
78
|
+
full_path = QueryParamHelper.set_query_params(API_URL, params)
|
79
|
+
api_resp = Faraday.get(full_path)
|
80
|
+
JSON.parse(api_resp.body)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
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.9.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-08-
|
11
|
+
date: 2017-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- lib/cryptocompare/coin_snapshot.rb
|
132
132
|
- lib/cryptocompare/helpers/exchange_name_helper.rb
|
133
133
|
- lib/cryptocompare/helpers/query_param_helper.rb
|
134
|
+
- lib/cryptocompare/histo_day.rb
|
134
135
|
- lib/cryptocompare/histo_hour.rb
|
135
136
|
- lib/cryptocompare/histo_minute.rb
|
136
137
|
- lib/cryptocompare/price.rb
|