cryptoexchange 0.10.3 → 0.10.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 622378716455966ef16315dd8e0db36a37b753e9
4
- data.tar.gz: a3a95c9575f3a6c75f73fbd91a31be577e6a012b
3
+ metadata.gz: 7bb5f56f4960e4106321369f548e4447fdea9ff2
4
+ data.tar.gz: da706e292376563eb40f1fbf2d34219a47c79947
5
5
  SHA512:
6
- metadata.gz: ee05e45677b9de4a2a9c2143ace02ce9eb9f8efbfcffd0b694c19bc2c1a6414a24e5995030aa1fc3a5bf7ddd56fb3b361c3a1dfcb8ced64c023b6219224934c7
7
- data.tar.gz: 23c34e2110a7e6d05b0fdecff54eb389e4ce37cd1f84499f09e236c7444d595bcccbfc644ab7f8304cc01e3f4ba49d9c62b256ae844b57f4ccb8c62116aa3d7c
6
+ metadata.gz: d9d7c94137fb7444f74c00b5f3d73190e6df997628c6afa2a100c7988aed28b136c0e712c422ebcb1057b9482b0b462c9d9b0ac0b78acff7f9803a883cc342a6
7
+ data.tar.gz: 514812b1f6cd5a810e0305e248415a86c181580ea241809e0f4fe42701bcc83402ad9bb7fc25bc6370751767df9a060e22c3e2b755f3f3fad336e460b9e2d2b9
data/README.md CHANGED
@@ -30,7 +30,7 @@ Or install it yourself as:
30
30
  | Bitcoin Indonesia | Y | | | | User-Defined|
31
31
  | Bitfinex | Y | | | | Y |
32
32
  | Bitflyer | Y | | | | Y |
33
- | Bithumb | Y | | | | User-Defined|
33
+ | Bithumb | Y | | | | Y |
34
34
  | Bitso | Y | | | | Y |
35
35
  | Bitstamp | Y | | | | User-Defined|
36
36
  | Bittrex | Y | | | | Y |
@@ -4,21 +4,34 @@ module Cryptoexchange::Exchanges
4
4
  class Market < Cryptoexchange::Services::Market
5
5
  class << self
6
6
  def supports_individual_ticker_query?
7
- true
7
+ false
8
8
  end
9
9
  end
10
10
 
11
- def fetch(market_pair)
12
- output = super(ticker_url(market_pair))
13
- adapt(output, market_pair)
11
+ def fetch
12
+ output = super ticker_url
13
+ adapt_all(output)
14
14
  end
15
15
 
16
- def ticker_url(market_pair)
17
- "#{Cryptoexchange::Exchanges::Bithumb::Market::API_URL}/public/ticker/#{market_pair.base}"
16
+ def ticker_url
17
+ "#{Cryptoexchange::Exchanges::Bithumb::Market::API_URL}/public/ticker/all"
18
18
  end
19
19
 
20
- def adapt(output, market_pair)
21
- market = output['data']
20
+ def adapt_all(output)
21
+ output['data'].map do |target, ticker|
22
+ base = target
23
+ target = 'KRW'
24
+ market_pair = Cryptoexchange::Models::MarketPair.new(
25
+ base: base,
26
+ target: target,
27
+ market: Bithumb::Market::NAME
28
+ )
29
+ adapt(ticker, market_pair, output['data']['date'])
30
+ end
31
+ end
32
+
33
+ def adapt(output, market_pair, date)
34
+ market = output
22
35
  ticker = Cryptoexchange::Models::Ticker.new
23
36
  ticker.base = market_pair.base
24
37
  ticker.target = market_pair.target
@@ -30,7 +43,7 @@ module Cryptoexchange::Exchanges
30
43
  ticker.low = NumericHelper.to_d(market['min_price'])
31
44
  #use 1day volume instead of 7days
32
45
  ticker.volume = NumericHelper.to_d(market['volume_1day'])
33
- ticker.timestamp = market['date'].to_i / 1000
46
+ ticker.timestamp = date.to_i / 1000
34
47
  ticker.payload = market
35
48
  ticker
36
49
  end
@@ -2,6 +2,7 @@ module Cryptoexchange::Exchanges
2
2
  module Bithumb
3
3
  module Services
4
4
  class Pairs < Cryptoexchange::Services::Pairs
5
+ PAIRS_URL = "#{Cryptoexchange::Exchanges::Bithumb::Market::API_URL}/public/ticker/all"
5
6
 
6
7
  def fetch
7
8
  output = super
@@ -9,16 +10,16 @@ module Cryptoexchange::Exchanges
9
10
  end
10
11
 
11
12
  def adapt(output)
12
- market_pairs = []
13
- output.each do |pair|
14
- market_pairs << Cryptoexchange::Models::MarketPair.new(
15
- base: pair[:base],
16
- target: pair[:target],
17
- market: Bithumb::Market::NAME
18
- )
13
+ pairs = []
14
+ output['data'].keys.each do |base|
15
+ next if base == 'date'
16
+ pairs << Cryptoexchange::Models::MarketPair.new(
17
+ base: base,
18
+ target: 'KRW',
19
+ market: Bithumb::Market::NAME
20
+ )
19
21
  end
20
-
21
- market_pairs
22
+ pairs
22
23
  end
23
24
  end
24
25
  end
@@ -1,3 +1,3 @@
1
1
  module Cryptoexchange
2
- VERSION = "0.10.3"
2
+ VERSION = "0.10.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptoexchange
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - TM Lee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-16 00:00:00.000000000 Z
11
+ date: 2017-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -147,7 +147,6 @@ files:
147
147
  - lib/cryptoexchange/exchanges/bitflyer/market.rb
148
148
  - lib/cryptoexchange/exchanges/bitflyer/services/market.rb
149
149
  - lib/cryptoexchange/exchanges/bitflyer/services/pairs.rb
150
- - lib/cryptoexchange/exchanges/bithumb/bithumb.yml
151
150
  - lib/cryptoexchange/exchanges/bithumb/market.rb
152
151
  - lib/cryptoexchange/exchanges/bithumb/services/market.rb
153
152
  - lib/cryptoexchange/exchanges/bithumb/services/pairs.rb
@@ -1,15 +0,0 @@
1
- :pairs:
2
- - :base: BTC
3
- :target: KRW
4
- - :base: ETH
5
- :target: KRW
6
- - :base: DASH
7
- :target: KRW
8
- - :base: LTC
9
- :target: KRW
10
- - :base: ETC
11
- :target: KRW
12
- - :base: XRP
13
- :target: KRW
14
- - :base: BCH
15
- :target: KRW