cryptoexchange 0.6.3 → 0.7.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/README.md +1 -0
- data/lib/cryptoexchange/exchanges/bittrex/services/market.rb +7 -6
- data/lib/cryptoexchange/exchanges/bittrex/services/pairs.rb +2 -2
- data/lib/cryptoexchange/exchanges/bleutrade/services/market.rb +4 -4
- data/lib/cryptoexchange/exchanges/bleutrade/services/pairs.rb +3 -3
- data/lib/cryptoexchange/exchanges/cryptopia/services/market.rb +1 -1
- data/lib/cryptoexchange/exchanges/ether_delta/services/market.rb +2 -2
- data/lib/cryptoexchange/exchanges/ether_delta/services/pairs.rb +3 -1
- data/lib/cryptoexchange/exchanges/poloniex/services/market.rb +4 -2
- data/lib/cryptoexchange/exchanges/poloniex/services/pairs.rb +3 -1
- data/lib/cryptoexchange/exchanges/tidex/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/tidex/services/market.rb +45 -0
- data/lib/cryptoexchange/exchanges/tidex/services/pairs.rb +25 -0
- data/lib/cryptoexchange/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e2eb4f1df95929e2a318e25f14d3470c5cc88f2
|
4
|
+
data.tar.gz: 477c991a4337aedc3ff38b708202cab7fcdacfbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a834077db0e1e2d44ddc4b96638014c6cbdebc73b04695048d24ad526f0a71bb725a23b7c1c4a1c99cc146a880c61001b8cc72b63ee031a98413a3cb8089945
|
7
|
+
data.tar.gz: 6de66fe05b62640b2a50bceeefd90bb44e0001dd371aa725009d778236607179da2c57bf6a26a4b8f9ef81e2b4b2205e1da02aff084bf54b1c9bfa93e71c48d9
|
data/README.md
CHANGED
@@ -10,28 +10,29 @@ module Cryptoexchange::Exchanges
|
|
10
10
|
|
11
11
|
def fetch(market_pair)
|
12
12
|
output = super(ticker_url(market_pair))
|
13
|
-
adapt(output)
|
13
|
+
adapt(output, market_pair)
|
14
14
|
end
|
15
15
|
|
16
16
|
def ticker_url(market_pair)
|
17
17
|
base = market_pair.base
|
18
18
|
target = market_pair.target
|
19
|
-
|
19
|
+
# Bittrex pair has BTC comes first, when BTC is typically a Target not a Base
|
20
|
+
"#{Cryptoexchange::Exchanges::Bittrex::Market::API_URL}/public/getmarketsummary?market=#{target}-#{base}"
|
20
21
|
end
|
21
22
|
|
22
|
-
def adapt(output)
|
23
|
+
def adapt(output, market_pair)
|
23
24
|
ticker = Cryptoexchange::Models::Ticker.new
|
24
25
|
market = output['result'][0]
|
25
26
|
|
26
|
-
ticker.base =
|
27
|
-
ticker.target =
|
27
|
+
ticker.base = market_pair.base
|
28
|
+
ticker.target = market_pair.target
|
28
29
|
ticker.market = Bittrex::Market::NAME
|
29
30
|
ticker.last = NumericHelper.to_d(market['Last'])
|
30
31
|
ticker.high = NumericHelper.to_d(market['High'])
|
31
32
|
ticker.low = NumericHelper.to_d(market['Low'])
|
32
33
|
ticker.ask = NumericHelper.to_d(market['Ask'])
|
33
34
|
ticker.bid = NumericHelper.to_d(market['Bid'])
|
34
|
-
ticker.volume = NumericHelper.to_d(market['
|
35
|
+
ticker.volume = NumericHelper.to_d(market['Volume'])
|
35
36
|
ticker.timestamp = DateTime.now.to_time.to_i
|
36
37
|
ticker.payload = market
|
37
38
|
ticker
|
@@ -14,8 +14,8 @@ module Cryptoexchange::Exchanges
|
|
14
14
|
market_pairs = []
|
15
15
|
pairs.each do |pair|
|
16
16
|
market_pairs << Cryptoexchange::Models::MarketPair.new(
|
17
|
-
base: pair['
|
18
|
-
target: pair['
|
17
|
+
base: pair['MarketCurrency'],
|
18
|
+
target: pair['BaseCurrency'],
|
19
19
|
market: Bittrex::Market::NAME
|
20
20
|
)
|
21
21
|
end
|
@@ -19,10 +19,10 @@ module Cryptoexchange::Exchanges
|
|
19
19
|
|
20
20
|
def adapt_all(output)
|
21
21
|
output['result'].map do |ticker|
|
22
|
-
|
22
|
+
base, target = ticker['MarketName'].split("_")
|
23
23
|
market_pair = Cryptoexchange::Models::MarketPair.new(
|
24
|
-
base:
|
25
|
-
target:
|
24
|
+
base: base,
|
25
|
+
target: target,
|
26
26
|
market: Bleutrade::Market::NAME
|
27
27
|
)
|
28
28
|
adapt(ticker, market_pair)
|
@@ -39,7 +39,7 @@ module Cryptoexchange::Exchanges
|
|
39
39
|
ticker.last = NumericHelper.to_d(output['Last'])
|
40
40
|
ticker.high = NumericHelper.to_d(output['High'])
|
41
41
|
ticker.low = NumericHelper.to_d(output['Low'])
|
42
|
-
ticker.volume = NumericHelper.to_d(output['
|
42
|
+
ticker.volume = NumericHelper.to_d(output['Volume'])
|
43
43
|
ticker.timestamp = Time.parse(output['TimeStamp']).to_i
|
44
44
|
ticker.payload = output
|
45
45
|
ticker
|
@@ -4,7 +4,6 @@ module Cryptoexchange::Exchanges
|
|
4
4
|
class Pairs < Cryptoexchange::Services::Pairs
|
5
5
|
PAIRS_URL = "#{Cryptoexchange::Exchanges::Bleutrade::Market::API_URL}/public/getmarkets"
|
6
6
|
|
7
|
-
|
8
7
|
def fetch
|
9
8
|
output = super
|
10
9
|
adapt(output)
|
@@ -13,9 +12,10 @@ module Cryptoexchange::Exchanges
|
|
13
12
|
def adapt(output)
|
14
13
|
market_pairs = []
|
15
14
|
output['result'].each do |pair|
|
15
|
+
base, target = pair['MarketName'].split("_")
|
16
16
|
market_pairs << Cryptoexchange::Models::MarketPair.new(
|
17
|
-
base:
|
18
|
-
target:
|
17
|
+
base: base,
|
18
|
+
target: target,
|
19
19
|
market: Bleutrade::Market::NAME
|
20
20
|
)
|
21
21
|
end
|
@@ -32,7 +32,7 @@ module Cryptoexchange::Exchanges
|
|
32
32
|
ticker.ask = NumericHelper.to_d(data['AskPrice'])
|
33
33
|
ticker.high = NumericHelper.to_d(data['High'])
|
34
34
|
ticker.low = NumericHelper.to_d(data['Low'])
|
35
|
-
ticker.volume = NumericHelper.to_d(data['
|
35
|
+
ticker.volume = NumericHelper.to_d(data['Volume'])
|
36
36
|
ticker.change = NumericHelper.to_d(data['Change'])
|
37
37
|
ticker.timestamp = Time.now.to_i
|
38
38
|
ticker.payload = data
|
@@ -20,7 +20,7 @@ module Cryptoexchange::Exchanges
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def adapt(output, market_pair)
|
23
|
-
name = "#{market_pair.
|
23
|
+
name = "#{market_pair.target}_#{market_pair.base}"
|
24
24
|
market = output[name]
|
25
25
|
|
26
26
|
ticker = Cryptoexchange::Models::Ticker.new
|
@@ -30,7 +30,7 @@ module Cryptoexchange::Exchanges
|
|
30
30
|
ticker.last = NumericHelper.to_d(market['last'].to_s)
|
31
31
|
ticker.bid = NumericHelper.to_d(market['bid'].to_s)
|
32
32
|
ticker.ask = NumericHelper.to_d(market['ask'].to_s)
|
33
|
-
ticker.volume = NumericHelper.to_d(market['
|
33
|
+
ticker.volume = NumericHelper.to_d(market['quoteVolume'].to_s)
|
34
34
|
ticker.timestamp = DateTime.now.to_time.to_i
|
35
35
|
ticker.payload = market
|
36
36
|
ticker
|
@@ -11,7 +11,9 @@ module Cryptoexchange::Exchanges
|
|
11
11
|
|
12
12
|
def adapt(output)
|
13
13
|
output.keys.map do |pair|
|
14
|
-
|
14
|
+
# format example: ETH_ZRX
|
15
|
+
# ETH is the Target, ZRX is the Base
|
16
|
+
target, base = pair.split('_')
|
15
17
|
|
16
18
|
Cryptoexchange::Models::MarketPair.new({
|
17
19
|
base: base,
|
@@ -19,7 +19,9 @@ module Cryptoexchange::Exchanges
|
|
19
19
|
|
20
20
|
def adapt_all(output)
|
21
21
|
output.map do |pair, ticker|
|
22
|
-
|
22
|
+
# Target comes first in Poloniex ie. BTC-BCN
|
23
|
+
# BTC cannot be a base in this pair
|
24
|
+
target, base = pair.split('_')
|
23
25
|
market_pair = Cryptoexchange::Models::MarketPair.new(
|
24
26
|
base: base,
|
25
27
|
target: target,
|
@@ -40,7 +42,7 @@ module Cryptoexchange::Exchanges
|
|
40
42
|
ticker.ask = NumericHelper.to_d(output['lowestAsk'])
|
41
43
|
ticker.high = NumericHelper.to_d(output['high24hr'])
|
42
44
|
ticker.low = NumericHelper.to_d(output['low24hr'])
|
43
|
-
ticker.volume = NumericHelper.to_d(output['
|
45
|
+
ticker.volume = NumericHelper.to_d(output['quoteVolume'])
|
44
46
|
ticker.timestamp = Time.now.to_i
|
45
47
|
ticker.payload = output
|
46
48
|
ticker
|
@@ -13,7 +13,9 @@ module Cryptoexchange::Exchanges
|
|
13
13
|
market_pairs = []
|
14
14
|
output.each do |pair, ticker|
|
15
15
|
market_pair = Cryptoexchange::Models::MarketPair.new
|
16
|
-
|
16
|
+
# Target comes first in Poloniex ie. BTC-BCN
|
17
|
+
# BTC cannot be a base in this pair
|
18
|
+
target, base = pair.split('_')
|
17
19
|
market_pair.base = base
|
18
20
|
market_pair.target = target
|
19
21
|
market_pair.market = Poloniex::Market::NAME
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'bigdecimal'
|
2
|
+
|
3
|
+
module Cryptoexchange::Exchanges
|
4
|
+
module Tidex
|
5
|
+
module Services
|
6
|
+
class Market < Cryptoexchange::Services::Market
|
7
|
+
class << self
|
8
|
+
def supports_individual_ticker_query?
|
9
|
+
true
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def fetch(market_pair)
|
14
|
+
output = super(ticker_url(market_pair))
|
15
|
+
adapt(output, market_pair)
|
16
|
+
end
|
17
|
+
|
18
|
+
def ticker_url(market_pair)
|
19
|
+
name = "#{market_pair.base}_#{market_pair.target}".downcase
|
20
|
+
|
21
|
+
"#{Cryptoexchange::Exchanges::Tidex::Market::API_URL}/ticker/#{name}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def adapt(output, market_pair)
|
25
|
+
name = "#{market_pair.base}_#{market_pair.target}".downcase
|
26
|
+
market = output[name]
|
27
|
+
|
28
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
29
|
+
ticker.base = market_pair.base
|
30
|
+
ticker.target = market_pair.target
|
31
|
+
ticker.market = Tidex::Market::NAME
|
32
|
+
ticker.last = NumericHelper.to_d(market['last'])
|
33
|
+
ticker.bid = NumericHelper.to_d(market['buy'])
|
34
|
+
ticker.ask = NumericHelper.to_d(market['sell'])
|
35
|
+
ticker.high = NumericHelper.to_d(market['high'])
|
36
|
+
ticker.low = NumericHelper.to_d(market['low'])
|
37
|
+
ticker.volume = NumericHelper.to_d(market['vol_cur'])
|
38
|
+
ticker.timestamp = NumericHelper.to_d(market['updated'])
|
39
|
+
ticker.payload = market
|
40
|
+
ticker
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Tidex
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Tidex::Market::API_URL}/info"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
output['pairs'].keys.map do |pair|
|
14
|
+
base, target = pair.split("_")
|
15
|
+
Cryptoexchange::Models::MarketPair.new({
|
16
|
+
base: base,
|
17
|
+
target: target,
|
18
|
+
market: Tidex::Market::NAME
|
19
|
+
})
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
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.7.0
|
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-08-
|
11
|
+
date: 2017-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -230,6 +230,9 @@ files:
|
|
230
230
|
- lib/cryptoexchange/exchanges/quoine/market.rb
|
231
231
|
- lib/cryptoexchange/exchanges/quoine/services/market.rb
|
232
232
|
- lib/cryptoexchange/exchanges/quoine/services/pairs.rb
|
233
|
+
- lib/cryptoexchange/exchanges/tidex/market.rb
|
234
|
+
- lib/cryptoexchange/exchanges/tidex/services/market.rb
|
235
|
+
- lib/cryptoexchange/exchanges/tidex/services/pairs.rb
|
233
236
|
- lib/cryptoexchange/exchanges/viabtc/market.rb
|
234
237
|
- lib/cryptoexchange/exchanges/viabtc/services/market.rb
|
235
238
|
- lib/cryptoexchange/exchanges/viabtc/services/pairs.rb
|