cryptocompare 0.8.0 → 0.9.0

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
  SHA1:
3
- metadata.gz: 5904d15aafe69b345265133262f61f2644155957
4
- data.tar.gz: 2e2aefc132bc419487894755aec41b4abf695fd3
3
+ metadata.gz: 3214abf1e4db6cdc7ad1b14fae33f48991f4b14c
4
+ data.tar.gz: 99daf1104f9a4e855d2972d50d735615d0f57b53
5
5
  SHA512:
6
- metadata.gz: 0ab351322c5f2a7044c451fb580d90bcb7e560de42c78d0c6df6d5104784256e2fca5b0a2fc94698ef9e1cd3fe0792e65aa8a1a67379a11f91697c5d4b017487
7
- data.tar.gz: e8b84aa64788c9810f1ba7668497811f8c29c4c8df01c1d5b37bfd905e3e3627165adc87efeb68c65efc4a62ca7024e0356702482797cd37b2572ae66485d370
6
+ metadata.gz: 10a42fc41ffe732ba377ca3246e41730cfab7bb27ac56feb893520b7b5b6ae63cb9ed14f6d624a10022e42b93c1e8864a154065c5279af5707e37f06a33c85c2
7
+ data.tar.gz: 1fc267b87ab24e42c4fc657e5928aa09557c5774a195e91e4bda933dd82ceb758a8c54083997e2d6a85c0c939467f5afb11a746522c1abc70fdbd63095d7e51e
@@ -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
@@ -2,8 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in cryptocompare.gemspec
4
4
  gemspec
5
-
6
- group :test do
7
- gem "simplecov"
8
- gem "codeclimate-test-reporter", "~> 1.0.0"
9
- end
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
@@ -1,5 +1,6 @@
1
1
  require_relative "cryptocompare/version"
2
2
  require_relative "cryptocompare/coin_snapshot"
3
+ require_relative "cryptocompare/histo_day"
3
4
  require_relative "cryptocompare/histo_hour"
4
5
  require_relative "cryptocompare/histo_minute"
5
6
  require_relative "cryptocompare/price"
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Cryptocompare
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  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.8.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-21 00:00:00.000000000 Z
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