cryptoexchange 0.2.1 → 0.3.1
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/README.md +16 -5
- data/lib/cryptoexchange.rb +3 -1
- data/lib/cryptoexchange/client.rb +5 -17
- data/lib/cryptoexchange/exchanges/anx/services/market.rb +11 -11
- data/lib/cryptoexchange/exchanges/bitcoin_indonesia/services/market.rb +13 -13
- data/lib/cryptoexchange/exchanges/bitflyer/services/market.rb +10 -10
- data/lib/cryptoexchange/exchanges/bithumb/bithumb.yml +13 -0
- data/lib/cryptoexchange/exchanges/bithumb/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/bithumb/models/market_pair.rb +8 -0
- data/lib/cryptoexchange/exchanges/bithumb/models/ticker.rb +8 -0
- data/lib/cryptoexchange/exchanges/bithumb/services/market.rb +40 -0
- data/lib/cryptoexchange/exchanges/bithumb/services/pairs.rb +26 -0
- data/lib/cryptoexchange/exchanges/bitstamp/market.rb +1 -1
- data/lib/cryptoexchange/exchanges/bitstamp/services/market.rb +13 -13
- data/lib/cryptoexchange/exchanges/bittrex/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/bittrex/models/market_pair.rb +8 -0
- data/lib/cryptoexchange/exchanges/bittrex/models/ticker.rb +8 -0
- data/lib/cryptoexchange/exchanges/bittrex/services/market.rb +42 -0
- data/lib/cryptoexchange/exchanges/bittrex/services/pairs.rb +28 -0
- data/lib/cryptoexchange/exchanges/bleutrade/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/bleutrade/models/market_pair.rb +8 -0
- data/lib/cryptoexchange/exchanges/bleutrade/models/ticker.rb +8 -0
- data/lib/cryptoexchange/exchanges/bleutrade/services/market.rb +50 -0
- data/lib/cryptoexchange/exchanges/bleutrade/services/pairs.rb +27 -0
- data/lib/cryptoexchange/exchanges/btcc/services/market.rb +12 -12
- data/lib/cryptoexchange/exchanges/bter/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/bter/models/market_pair.rb +8 -0
- data/lib/cryptoexchange/exchanges/bter/models/ticker.rb +8 -0
- data/lib/cryptoexchange/exchanges/bter/services/market.rb +38 -0
- data/lib/cryptoexchange/exchanges/bter/services/pairs.rb +26 -0
- data/lib/cryptoexchange/exchanges/ccex/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/ccex/models/market_pair.rb +8 -0
- data/lib/cryptoexchange/exchanges/ccex/models/ticker.rb +8 -0
- data/lib/cryptoexchange/exchanges/ccex/services/market.rb +48 -0
- data/lib/cryptoexchange/exchanges/ccex/services/pairs.rb +26 -0
- data/lib/cryptoexchange/exchanges/coin_exchange/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/coin_exchange/models/market_pair.rb +8 -0
- data/lib/cryptoexchange/exchanges/coin_exchange/models/ticker.rb +8 -0
- data/lib/cryptoexchange/exchanges/coin_exchange/services/market.rb +70 -0
- data/lib/cryptoexchange/exchanges/coin_exchange/services/pairs.rb +24 -0
- data/lib/cryptoexchange/exchanges/coincheck/services/market.rb +12 -12
- data/lib/cryptoexchange/exchanges/coinone/services/market.rb +10 -10
- data/lib/cryptoexchange/exchanges/cryptopia/services/market.rb +13 -13
- data/lib/cryptoexchange/exchanges/ether_delta/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/ether_delta/models/market_pair.rb +8 -0
- data/lib/cryptoexchange/exchanges/ether_delta/models/ticker.rb +8 -0
- data/lib/cryptoexchange/exchanges/ether_delta/services/market.rb +41 -0
- data/lib/cryptoexchange/exchanges/ether_delta/services/pairs.rb +26 -0
- data/lib/cryptoexchange/exchanges/gatecoin/services/market.rb +11 -11
- data/lib/cryptoexchange/exchanges/gemini/services/market.rb +4 -4
- data/lib/cryptoexchange/exchanges/hitbtc/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/hitbtc/models/market_pair.rb +8 -0
- data/lib/cryptoexchange/exchanges/hitbtc/models/ticker.rb +8 -0
- data/lib/cryptoexchange/exchanges/hitbtc/services/market.rb +42 -0
- data/lib/cryptoexchange/exchanges/hitbtc/services/pairs.rb +24 -0
- data/lib/cryptoexchange/exchanges/korbit/services/market.rb +12 -12
- data/lib/cryptoexchange/exchanges/lakebtc/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/lakebtc/models/market_pair.rb +8 -0
- data/lib/cryptoexchange/exchanges/lakebtc/models/ticker.rb +8 -0
- data/lib/cryptoexchange/exchanges/lakebtc/services/market.rb +51 -0
- data/lib/cryptoexchange/exchanges/lakebtc/services/pairs.rb +29 -0
- data/lib/cryptoexchange/exchanges/liqui/services/market.rb +6 -6
- data/lib/cryptoexchange/exchanges/livecoin/services/market.rb +12 -12
- data/lib/cryptoexchange/exchanges/novaexchange/services/market.rb +13 -13
- data/lib/cryptoexchange/exchanges/novaexchange/services/pairs.rb +6 -2
- data/lib/cryptoexchange/exchanges/okcoin/services/market.rb +12 -12
- data/lib/cryptoexchange/helpers/hash_helper.rb +20 -0
- data/lib/cryptoexchange/helpers/numeric_helper.rb +7 -0
- data/lib/cryptoexchange/version.rb +1 -1
- metadata +50 -2
@@ -0,0 +1,29 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Lakebtc
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Lakebtc::Market::API_URL}/ticker"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
market_pairs = []
|
14
|
+
output.keys.each do |pair|
|
15
|
+
if pair.include?('btc')
|
16
|
+
market_pairs << Lakebtc::Models::MarketPair.new(
|
17
|
+
base: 'btc',
|
18
|
+
target: pair[3..-1],
|
19
|
+
market: Lakebtc::Market::NAME
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
market_pairs
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -27,12 +27,12 @@ module Cryptoexchange::Exchanges
|
|
27
27
|
ticker.base = market_pair.base
|
28
28
|
ticker.target = market_pair.target
|
29
29
|
ticker.market = Liqui::Market::NAME
|
30
|
-
ticker.last =
|
31
|
-
ticker.bid =
|
32
|
-
ticker.ask =
|
33
|
-
ticker.high =
|
34
|
-
ticker.low =
|
35
|
-
ticker.volume =
|
30
|
+
ticker.last = NumericHelper.to_d(market['last'])
|
31
|
+
ticker.bid = NumericHelper.to_d(market['buy'])
|
32
|
+
ticker.ask = NumericHelper.to_d(market['sell'])
|
33
|
+
ticker.high = NumericHelper.to_d(market['high'])
|
34
|
+
ticker.low = NumericHelper.to_d(market['low'])
|
35
|
+
ticker.volume = NumericHelper.to_d(market['vol'])
|
36
36
|
ticker.timestamp = DateTime.now.to_time.to_i
|
37
37
|
ticker.payload = market
|
38
38
|
ticker
|
@@ -31,18 +31,18 @@ module Cryptoexchange::Exchanges
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def adapt(output, market_pair)
|
34
|
-
ticker
|
35
|
-
ticker.base
|
36
|
-
ticker.target
|
37
|
-
ticker.market
|
38
|
-
ticker.last
|
39
|
-
ticker.bid
|
40
|
-
ticker.ask
|
41
|
-
ticker.high
|
42
|
-
ticker.low
|
43
|
-
ticker.volume
|
44
|
-
ticker.timestamp =
|
45
|
-
ticker.payload
|
34
|
+
ticker = Livecoin::Models::Ticker.new
|
35
|
+
ticker.base = market_pair.base
|
36
|
+
ticker.target = market_pair.target
|
37
|
+
ticker.market = Livecoin::Market::NAME
|
38
|
+
ticker.last = NumericHelper.to_d(output['last'])
|
39
|
+
ticker.bid = NumericHelper.to_d(output['best_bid'])
|
40
|
+
ticker.ask = NumericHelper.to_d(output['best_ask'])
|
41
|
+
ticker.high = NumericHelper.to_d(output['high'])
|
42
|
+
ticker.low = NumericHelper.to_d(output['low'])
|
43
|
+
ticker.volume = NumericHelper.to_d(output['volume'])
|
44
|
+
ticker.timestamp = Time.now.to_i
|
45
|
+
ticker.payload = output
|
46
46
|
ticker
|
47
47
|
end
|
48
48
|
end
|
@@ -16,7 +16,7 @@ module Cryptoexchange::Exchanges
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def ticker_url(market_pair)
|
19
|
-
name = "#{market_pair.
|
19
|
+
name = "#{market_pair.target}_#{market_pair.base}"
|
20
20
|
|
21
21
|
"#{Cryptoexchange::Exchanges::Novaexchange::Market::API_URL}/market/info/#{name}/"
|
22
22
|
end
|
@@ -24,18 +24,18 @@ module Cryptoexchange::Exchanges
|
|
24
24
|
def adapt(output, market_pair)
|
25
25
|
market = output['markets'][0]
|
26
26
|
|
27
|
-
ticker
|
28
|
-
ticker.base
|
29
|
-
ticker.target
|
30
|
-
ticker.market
|
31
|
-
ticker.last
|
32
|
-
ticker.bid
|
33
|
-
ticker.ask
|
34
|
-
ticker.high
|
35
|
-
ticker.low
|
36
|
-
ticker.volume
|
37
|
-
ticker.timestamp =
|
38
|
-
ticker.payload
|
27
|
+
ticker = Novaexchange::Models::Ticker.new
|
28
|
+
ticker.base = market_pair.base
|
29
|
+
ticker.target = market_pair.target
|
30
|
+
ticker.market = Novaexchange::Market::NAME
|
31
|
+
ticker.last = NumericHelper.to_d(market['last_price'])
|
32
|
+
ticker.bid = NumericHelper.to_d(market['bid'])
|
33
|
+
ticker.ask = NumericHelper.to_d(market['ask'])
|
34
|
+
ticker.high = NumericHelper.to_d(market['high24h'])
|
35
|
+
ticker.low = NumericHelper.to_d(market['low24h'])
|
36
|
+
ticker.volume = NumericHelper.to_d(market['volume24h'])
|
37
|
+
ticker.timestamp = Time.now.to_i
|
38
|
+
ticker.payload = market
|
39
39
|
ticker
|
40
40
|
end
|
41
41
|
end
|
@@ -13,8 +13,12 @@ module Cryptoexchange::Exchanges
|
|
13
13
|
market_pairs = []
|
14
14
|
output['markets'].each do |ticker|
|
15
15
|
market_pair = Novaexchange::Models::MarketPair.new
|
16
|
-
|
17
|
-
|
16
|
+
|
17
|
+
# Note: The base/target are swapped intentionally. It appears that
|
18
|
+
# the API endpoint is returning in the wrong order.
|
19
|
+
market_pair.base = ticker['currency']
|
20
|
+
market_pair.target = ticker['basecurrency']
|
21
|
+
|
18
22
|
market_pair.market = Novaexchange::Market::NAME
|
19
23
|
market_pairs << market_pair
|
20
24
|
end
|
@@ -20,18 +20,18 @@ module Cryptoexchange::Exchanges
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def adapt(output, market_pair)
|
23
|
-
ticker
|
24
|
-
ticker.base
|
25
|
-
ticker.target
|
26
|
-
ticker.market
|
27
|
-
ticker.ask
|
28
|
-
ticker.bid
|
29
|
-
ticker.last
|
30
|
-
ticker.high
|
31
|
-
ticker.low
|
32
|
-
ticker.volume
|
33
|
-
ticker.timestamp = output['date']
|
34
|
-
ticker.payload
|
23
|
+
ticker = Okcoin::Models::Ticker.new
|
24
|
+
ticker.base = market_pair.base
|
25
|
+
ticker.target = market_pair.target
|
26
|
+
ticker.market = Okcoin::Market::NAME
|
27
|
+
ticker.ask = NumericHelper.to_d(output['ticker']['sell'])
|
28
|
+
ticker.bid = NumericHelper.to_d(output['ticker']['buy'])
|
29
|
+
ticker.last = NumericHelper.to_d(output['ticker']['last'])
|
30
|
+
ticker.high = NumericHelper.to_d(output['ticker']['high'])
|
31
|
+
ticker.low = NumericHelper.to_d(output['ticker']['low'])
|
32
|
+
ticker.volume = NumericHelper.to_d(output['ticker']['vol'])
|
33
|
+
ticker.timestamp = output['date'].to_i
|
34
|
+
ticker.payload = output
|
35
35
|
ticker
|
36
36
|
end
|
37
37
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module HashHelper
|
2
|
+
class << self
|
3
|
+
# "Polyfill" of the Hash#dig method from Ruby 2.3
|
4
|
+
#
|
5
|
+
# Examples
|
6
|
+
#
|
7
|
+
# > dig({a: {b: 1}}, :a, :b)
|
8
|
+
# => 2
|
9
|
+
#
|
10
|
+
# > dig({a: {b: 1}}, :a, :c)
|
11
|
+
# => nil
|
12
|
+
def dig(obj, *args)
|
13
|
+
if obj.nil? || args.empty?
|
14
|
+
obj
|
15
|
+
else
|
16
|
+
dig(obj[args.first], *args[1..-1])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
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.
|
4
|
+
version: 0.3.1
|
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-07-
|
11
|
+
date: 2017-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -145,18 +145,49 @@ files:
|
|
145
145
|
- lib/cryptoexchange/exchanges/bitflyer/models/ticker.rb
|
146
146
|
- lib/cryptoexchange/exchanges/bitflyer/services/market.rb
|
147
147
|
- lib/cryptoexchange/exchanges/bitflyer/services/pairs.rb
|
148
|
+
- lib/cryptoexchange/exchanges/bithumb/bithumb.yml
|
149
|
+
- lib/cryptoexchange/exchanges/bithumb/market.rb
|
150
|
+
- lib/cryptoexchange/exchanges/bithumb/models/market_pair.rb
|
151
|
+
- lib/cryptoexchange/exchanges/bithumb/models/ticker.rb
|
152
|
+
- lib/cryptoexchange/exchanges/bithumb/services/market.rb
|
153
|
+
- lib/cryptoexchange/exchanges/bithumb/services/pairs.rb
|
148
154
|
- lib/cryptoexchange/exchanges/bitstamp/bitstamp.yml
|
149
155
|
- lib/cryptoexchange/exchanges/bitstamp/market.rb
|
150
156
|
- lib/cryptoexchange/exchanges/bitstamp/models/market_pair.rb
|
151
157
|
- lib/cryptoexchange/exchanges/bitstamp/models/ticker.rb
|
152
158
|
- lib/cryptoexchange/exchanges/bitstamp/services/market.rb
|
153
159
|
- lib/cryptoexchange/exchanges/bitstamp/services/pairs.rb
|
160
|
+
- lib/cryptoexchange/exchanges/bittrex/market.rb
|
161
|
+
- lib/cryptoexchange/exchanges/bittrex/models/market_pair.rb
|
162
|
+
- lib/cryptoexchange/exchanges/bittrex/models/ticker.rb
|
163
|
+
- lib/cryptoexchange/exchanges/bittrex/services/market.rb
|
164
|
+
- lib/cryptoexchange/exchanges/bittrex/services/pairs.rb
|
165
|
+
- lib/cryptoexchange/exchanges/bleutrade/market.rb
|
166
|
+
- lib/cryptoexchange/exchanges/bleutrade/models/market_pair.rb
|
167
|
+
- lib/cryptoexchange/exchanges/bleutrade/models/ticker.rb
|
168
|
+
- lib/cryptoexchange/exchanges/bleutrade/services/market.rb
|
169
|
+
- lib/cryptoexchange/exchanges/bleutrade/services/pairs.rb
|
154
170
|
- lib/cryptoexchange/exchanges/btcc/btcc.yml
|
155
171
|
- lib/cryptoexchange/exchanges/btcc/market.rb
|
156
172
|
- lib/cryptoexchange/exchanges/btcc/models/market_pair.rb
|
157
173
|
- lib/cryptoexchange/exchanges/btcc/models/ticker.rb
|
158
174
|
- lib/cryptoexchange/exchanges/btcc/services/market.rb
|
159
175
|
- lib/cryptoexchange/exchanges/btcc/services/pairs.rb
|
176
|
+
- lib/cryptoexchange/exchanges/bter/market.rb
|
177
|
+
- lib/cryptoexchange/exchanges/bter/models/market_pair.rb
|
178
|
+
- lib/cryptoexchange/exchanges/bter/models/ticker.rb
|
179
|
+
- lib/cryptoexchange/exchanges/bter/services/market.rb
|
180
|
+
- lib/cryptoexchange/exchanges/bter/services/pairs.rb
|
181
|
+
- lib/cryptoexchange/exchanges/ccex/market.rb
|
182
|
+
- lib/cryptoexchange/exchanges/ccex/models/market_pair.rb
|
183
|
+
- lib/cryptoexchange/exchanges/ccex/models/ticker.rb
|
184
|
+
- lib/cryptoexchange/exchanges/ccex/services/market.rb
|
185
|
+
- lib/cryptoexchange/exchanges/ccex/services/pairs.rb
|
186
|
+
- lib/cryptoexchange/exchanges/coin_exchange/market.rb
|
187
|
+
- lib/cryptoexchange/exchanges/coin_exchange/models/market_pair.rb
|
188
|
+
- lib/cryptoexchange/exchanges/coin_exchange/models/ticker.rb
|
189
|
+
- lib/cryptoexchange/exchanges/coin_exchange/services/market.rb
|
190
|
+
- lib/cryptoexchange/exchanges/coin_exchange/services/pairs.rb
|
160
191
|
- lib/cryptoexchange/exchanges/coincheck/coincheck.yml
|
161
192
|
- lib/cryptoexchange/exchanges/coincheck/market.rb
|
162
193
|
- lib/cryptoexchange/exchanges/coincheck/models/market_pair.rb
|
@@ -173,6 +204,11 @@ files:
|
|
173
204
|
- lib/cryptoexchange/exchanges/cryptopia/models/ticker.rb
|
174
205
|
- lib/cryptoexchange/exchanges/cryptopia/services/market.rb
|
175
206
|
- lib/cryptoexchange/exchanges/cryptopia/services/pairs.rb
|
207
|
+
- lib/cryptoexchange/exchanges/ether_delta/market.rb
|
208
|
+
- lib/cryptoexchange/exchanges/ether_delta/models/market_pair.rb
|
209
|
+
- lib/cryptoexchange/exchanges/ether_delta/models/ticker.rb
|
210
|
+
- lib/cryptoexchange/exchanges/ether_delta/services/market.rb
|
211
|
+
- lib/cryptoexchange/exchanges/ether_delta/services/pairs.rb
|
176
212
|
- lib/cryptoexchange/exchanges/gatecoin/market.rb
|
177
213
|
- lib/cryptoexchange/exchanges/gatecoin/models/market_pair.rb
|
178
214
|
- lib/cryptoexchange/exchanges/gatecoin/models/ticker.rb
|
@@ -183,12 +219,22 @@ files:
|
|
183
219
|
- lib/cryptoexchange/exchanges/gemini/models/ticker.rb
|
184
220
|
- lib/cryptoexchange/exchanges/gemini/services/market.rb
|
185
221
|
- lib/cryptoexchange/exchanges/gemini/services/pairs.rb
|
222
|
+
- lib/cryptoexchange/exchanges/hitbtc/market.rb
|
223
|
+
- lib/cryptoexchange/exchanges/hitbtc/models/market_pair.rb
|
224
|
+
- lib/cryptoexchange/exchanges/hitbtc/models/ticker.rb
|
225
|
+
- lib/cryptoexchange/exchanges/hitbtc/services/market.rb
|
226
|
+
- lib/cryptoexchange/exchanges/hitbtc/services/pairs.rb
|
186
227
|
- lib/cryptoexchange/exchanges/korbit/korbit.yml
|
187
228
|
- lib/cryptoexchange/exchanges/korbit/market.rb
|
188
229
|
- lib/cryptoexchange/exchanges/korbit/models/market_pair.rb
|
189
230
|
- lib/cryptoexchange/exchanges/korbit/models/ticker.rb
|
190
231
|
- lib/cryptoexchange/exchanges/korbit/services/market.rb
|
191
232
|
- lib/cryptoexchange/exchanges/korbit/services/pairs.rb
|
233
|
+
- lib/cryptoexchange/exchanges/lakebtc/market.rb
|
234
|
+
- lib/cryptoexchange/exchanges/lakebtc/models/market_pair.rb
|
235
|
+
- lib/cryptoexchange/exchanges/lakebtc/models/ticker.rb
|
236
|
+
- lib/cryptoexchange/exchanges/lakebtc/services/market.rb
|
237
|
+
- lib/cryptoexchange/exchanges/lakebtc/services/pairs.rb
|
192
238
|
- lib/cryptoexchange/exchanges/liqui/market.rb
|
193
239
|
- lib/cryptoexchange/exchanges/liqui/models/market_pair.rb
|
194
240
|
- lib/cryptoexchange/exchanges/liqui/models/ticker.rb
|
@@ -210,6 +256,8 @@ files:
|
|
210
256
|
- lib/cryptoexchange/exchanges/okcoin/okcoin.yml
|
211
257
|
- lib/cryptoexchange/exchanges/okcoin/services/market.rb
|
212
258
|
- lib/cryptoexchange/exchanges/okcoin/services/pairs.rb
|
259
|
+
- lib/cryptoexchange/helpers/hash_helper.rb
|
260
|
+
- lib/cryptoexchange/helpers/numeric_helper.rb
|
213
261
|
- lib/cryptoexchange/helpers/string_helper.rb
|
214
262
|
- lib/cryptoexchange/lru_ttl_cache.rb
|
215
263
|
- lib/cryptoexchange/models/market_pair.rb
|