cryptoexchange 0.15.6 → 0.16.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 +7 -0
- data/lib/cryptoexchange/exchanges/bitconnect/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/bitconnect/services/market.rb +52 -0
- data/lib/cryptoexchange/exchanges/bitconnect/services/pairs.rb +26 -0
- data/lib/cryptoexchange/exchanges/cex/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/cex/services/market.rb +40 -0
- data/lib/cryptoexchange/exchanges/cex/services/order_book.rb +44 -0
- data/lib/cryptoexchange/exchanges/cex/services/pairs.rb +25 -0
- data/lib/cryptoexchange/exchanges/cex/services/trades.rb +32 -0
- data/lib/cryptoexchange/exchanges/coins_markets/services/market.rb +2 -2
- data/lib/cryptoexchange/exchanges/coins_markets/services/pairs.rb +1 -1
- data/lib/cryptoexchange/exchanges/gate/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/gate/services/market.rb +50 -0
- data/lib/cryptoexchange/exchanges/gate/services/order_book.rb +44 -0
- data/lib/cryptoexchange/exchanges/gate/services/pairs.rb +25 -0
- data/lib/cryptoexchange/exchanges/gate/services/trades.rb +32 -0
- data/lib/cryptoexchange/exchanges/kucoin/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/kucoin/services/market.rb +51 -0
- data/lib/cryptoexchange/exchanges/kucoin/services/pairs.rb +27 -0
- data/lib/cryptoexchange/exchanges/stocks_exchange/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/stocks_exchange/services/market.rb +50 -0
- data/lib/cryptoexchange/exchanges/stocks_exchange/services/pairs.rb +24 -0
- data/lib/cryptoexchange/version.rb +1 -1
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8b82d435378c2147816ddcb2c98b9d0bef47c94
|
4
|
+
data.tar.gz: df84b71e73d7d7b72e473c605693268541409760
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7703bf3e8ba0ff60992d66f4c1c6828f973b12125b9d67be3a540d56def33cf6edff930c46f54e576ed9ad815bf69326d4818a4c324c1eccc1df63078426f26
|
7
|
+
data.tar.gz: 28381b20e20ff35b732c05a78140633ff88513b23f82a93c64c64bc30036241b7a6e0e867ecd65fd4a3741227ca36baa9ba64394907622a9f3524308e5f7227c
|
data/README.md
CHANGED
@@ -31,6 +31,7 @@ Or install it yourself as:
|
|
31
31
|
| Binance | Y | Y | | | User-Defined|
|
32
32
|
| Bitbay | Y | | | | User-Defined|
|
33
33
|
| Bitcoin Indonesia | Y | | | | User-Defined|
|
34
|
+
| Bitconnect | Y | | | | Y |
|
34
35
|
| Bitfinex | Y | | | | Y |
|
35
36
|
| Bitflyer | Y | | | | Y |
|
36
37
|
| Bithumb | Y | | | | Y |
|
@@ -45,15 +46,19 @@ Or install it yourself as:
|
|
45
46
|
| BTCChina | | | | | |
|
46
47
|
| BTER | Y | | | | Y |
|
47
48
|
| BX Thailand | Y | | | | Y |
|
49
|
+
| Cex | Y | Y | Y | | Y |
|
48
50
|
| CCex | Y | | | | Y |
|
49
51
|
| CHBTC | Y | | | | User-Defined|
|
50
52
|
| Coincheck | Y | | | | User-Defined|
|
51
53
|
| CoinExchange | Y | | | | Y |
|
52
54
|
| Coinmate | Y | Y | | | User-Defined|
|
53
55
|
| Coinone | Y | | | | Y |
|
56
|
+
| CoinsMarkets | Y | | | | Y |
|
57
|
+
| COSS | Y | | | | Y |
|
54
58
|
| Cryptopia | Y | | | | Y |
|
55
59
|
| EtherDelta | Y | | | | Y |
|
56
60
|
| Exmo | Y | Y | Y | | Y |
|
61
|
+
| Gate | Y | Y | Y | | Y |
|
57
62
|
| Gatecoin | Y | | | | Y |
|
58
63
|
| GDAX | Y | | | | Y |
|
59
64
|
| Gemini | Y | Y | Y | | Y |
|
@@ -63,6 +68,7 @@ Or install it yourself as:
|
|
63
68
|
| Jubi | Y | | | | Y |
|
64
69
|
| Korbit | Y | | | | User-Defined|
|
65
70
|
| Kraken | Y | | | | Y |
|
71
|
+
| Kucoin | Y | | | | Y |
|
66
72
|
| LakeBTC | Y | | | | Y |
|
67
73
|
| Liqui | Y | | | | Y |
|
68
74
|
| LiteBit.eu | Y | | | | Y |
|
@@ -76,6 +82,7 @@ Or install it yourself as:
|
|
76
82
|
| Qryptos | Y | | | | Y |
|
77
83
|
| QuadrigaCX | Y | | | | User-Defined|
|
78
84
|
| Quoine | Y | | | | Y |
|
85
|
+
| Stocks Exchange | Y | | | | Y |
|
79
86
|
| SZZC | Y | | | | Y |
|
80
87
|
| The Rock Trading | Y | | | | Y |
|
81
88
|
| Tidex | Y | | | | Y |
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Bitconnect
|
3
|
+
module Services
|
4
|
+
class Market < Cryptoexchange::Services::Market
|
5
|
+
class << self
|
6
|
+
def supports_individual_ticker_query?
|
7
|
+
false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch
|
12
|
+
output = super ticker_url
|
13
|
+
adapt_all(output)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ticker_url
|
17
|
+
"#{Cryptoexchange::Exchanges::Bitconnect::Market::API_URL}/info"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt_all(output)
|
21
|
+
markets = output['markets']
|
22
|
+
markets.map do |value|
|
23
|
+
target, base = value['marketname'].split('_')
|
24
|
+
market_pair = Cryptoexchange::Models::MarketPair.new(
|
25
|
+
base: base,
|
26
|
+
target: target,
|
27
|
+
market: Bitconnect::Market::NAME
|
28
|
+
)
|
29
|
+
adapt(value, market_pair)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def adapt(output, market_pair)
|
34
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
35
|
+
ticker.base = market_pair.base
|
36
|
+
ticker.target = market_pair.target
|
37
|
+
ticker.market = Bitconnect::Market::NAME
|
38
|
+
ticker.ask = NumericHelper.to_d(output['ask'])
|
39
|
+
ticker.bid = NumericHelper.to_d(output['bid'])
|
40
|
+
ticker.last = NumericHelper.to_d(output['last_price'])
|
41
|
+
ticker.high = NumericHelper.to_d(output['high24h'])
|
42
|
+
ticker.low = NumericHelper.to_d(output['low24h'])
|
43
|
+
ticker.volume = NumericHelper.to_d(output['volume24h'])
|
44
|
+
ticker.change = NumericHelper.to_d(output['change24h'])
|
45
|
+
ticker.timestamp = Time.now.to_i
|
46
|
+
ticker.payload = output
|
47
|
+
ticker
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Bitconnect
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Bitconnect::Market::API_URL}/info"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
markets = output['markets']
|
14
|
+
markets.map do |value|
|
15
|
+
target, base = value['marketname'].split('_')
|
16
|
+
Cryptoexchange::Models::MarketPair.new(
|
17
|
+
base: base,
|
18
|
+
target: target,
|
19
|
+
market: Bitconnect::Market::NAME
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Cex
|
3
|
+
module Services
|
4
|
+
class Market < Cryptoexchange::Services::Market
|
5
|
+
class << self
|
6
|
+
def supports_individual_ticker_query?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch(market_pair)
|
12
|
+
output = super(ticker_url(market_pair))
|
13
|
+
adapt(output, market_pair)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ticker_url(market_pair)
|
17
|
+
"#{Cryptoexchange::Exchanges::Cex::Market::API_URL}/ticker/#{market_pair.base}/#{market_pair.target}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt(output, market_pair)
|
21
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
22
|
+
base = market_pair.base
|
23
|
+
target = market_pair.target
|
24
|
+
ticker.base = base
|
25
|
+
ticker.target = target
|
26
|
+
ticker.market = Cex::Market::NAME
|
27
|
+
ticker.ask = NumericHelper.to_d(output['ask'])
|
28
|
+
ticker.bid = NumericHelper.to_d(output['bid'])
|
29
|
+
ticker.low = NumericHelper.to_d(output['low'])
|
30
|
+
ticker.high = NumericHelper.to_d(output['high'])
|
31
|
+
ticker.last = NumericHelper.to_d(output['last'])
|
32
|
+
ticker.volume = NumericHelper.to_d(output['volume'])
|
33
|
+
ticker.timestamp = output['timestamp'].to_i
|
34
|
+
ticker.payload = output
|
35
|
+
ticker
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Cex
|
3
|
+
module Services
|
4
|
+
class OrderBook < Cryptoexchange::Services::Market
|
5
|
+
class << self
|
6
|
+
def supports_individual_ticker_query?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch(market_pair)
|
12
|
+
output = super(ticker_url(market_pair))
|
13
|
+
adapt(output, market_pair)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ticker_url(market_pair)
|
17
|
+
"#{Cryptoexchange::Exchanges::Cex::Market::API_URL}/order_book/#{market_pair.base}/#{market_pair.target}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt(output, market_pair)
|
21
|
+
order_book = Cryptoexchange::Models::OrderBook.new
|
22
|
+
|
23
|
+
order_book.base = market_pair.base
|
24
|
+
order_book.target = market_pair.target
|
25
|
+
order_book.market = Cex::Market::NAME
|
26
|
+
order_book.asks = adapt_orders output['asks']
|
27
|
+
order_book.bids = adapt_orders output['bids']
|
28
|
+
order_book.timestamp = output['timestamp']
|
29
|
+
order_book.payload = output
|
30
|
+
order_book
|
31
|
+
end
|
32
|
+
|
33
|
+
def adapt_orders(orders)
|
34
|
+
orders.collect do |order_entry|
|
35
|
+
price, amount = order_entry
|
36
|
+
Cryptoexchange::Models::Order.new(price: price,
|
37
|
+
amount: amount,
|
38
|
+
timestamp: nil)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Cex
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Cex::Market::API_URL}/currency_limits"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
pairs = output['data']['pairs']
|
14
|
+
pairs.map do |pair|
|
15
|
+
Cryptoexchange::Models::MarketPair.new(
|
16
|
+
base: pair['symbol1'],
|
17
|
+
target: pair['symbol2'],
|
18
|
+
market: Cex::Market::NAME
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Cex
|
3
|
+
module Services
|
4
|
+
class Trades < Cryptoexchange::Services::Market
|
5
|
+
def fetch(market_pair)
|
6
|
+
output = super(ticker_url(market_pair))
|
7
|
+
adapt(output, market_pair)
|
8
|
+
end
|
9
|
+
|
10
|
+
def ticker_url(market_pair)
|
11
|
+
"#{Cryptoexchange::Exchanges::Cex::Market::API_URL}/trade_history/#{market_pair.base}/#{market_pair.target}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def adapt(output, market_pair)
|
15
|
+
output.collect do |trade|
|
16
|
+
tr = Cryptoexchange::Models::Trade.new
|
17
|
+
tr.trade_id = trade['tid']
|
18
|
+
tr.base = market_pair.base
|
19
|
+
tr.target = market_pair.target
|
20
|
+
tr.market = Cex::Market::NAME
|
21
|
+
tr.type = trade['type']
|
22
|
+
tr.price = trade['price']
|
23
|
+
tr.amount = trade['amount']
|
24
|
+
tr.timestamp = trade['date'].to_i
|
25
|
+
tr.payload = trade
|
26
|
+
tr
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -19,7 +19,7 @@ module Cryptoexchange::Exchanges
|
|
19
19
|
|
20
20
|
def adapt_all(output)
|
21
21
|
output.map do |key, value|
|
22
|
-
|
22
|
+
target, base = key.split('_')
|
23
23
|
market_pair = Cryptoexchange::Models::MarketPair.new(
|
24
24
|
base: base,
|
25
25
|
target: target,
|
@@ -39,7 +39,7 @@ module Cryptoexchange::Exchanges
|
|
39
39
|
ticker.last = NumericHelper.to_d(output['last'])
|
40
40
|
ticker.high = NumericHelper.to_d(output['high24hr'])
|
41
41
|
ticker.low = NumericHelper.to_d(output['low24hr'])
|
42
|
-
ticker.volume = NumericHelper.to_d(output['24htrade'])
|
42
|
+
ticker.volume = NumericHelper.divide(NumericHelper.to_d(output['24htrade']), ticker.last)
|
43
43
|
ticker.timestamp = Time.now.to_i
|
44
44
|
ticker.payload = output
|
45
45
|
ticker
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Gate
|
3
|
+
module Services
|
4
|
+
class Market < Cryptoexchange::Services::Market
|
5
|
+
class << self
|
6
|
+
def supports_individual_ticker_query?
|
7
|
+
false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch
|
12
|
+
output = super ticker_url
|
13
|
+
adapt_all output
|
14
|
+
end
|
15
|
+
|
16
|
+
def ticker_url
|
17
|
+
"#{Cryptoexchange::Exchanges::Gate::Market::API_URL}/tickers"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt_all(output)
|
21
|
+
output.map do |market_pair_key, ticker|
|
22
|
+
base, target = market_pair_key.split('_')
|
23
|
+
market_pair = Cryptoexchange::Models::MarketPair.new(
|
24
|
+
base: base,
|
25
|
+
target: target,
|
26
|
+
market: Gate::Market::NAME
|
27
|
+
)
|
28
|
+
adapt(ticker, market_pair)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def adapt(output, market_pair)
|
33
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
34
|
+
ticker.base = market_pair.base
|
35
|
+
ticker.target = market_pair.target
|
36
|
+
ticker.market = Gate::Market::NAME
|
37
|
+
ticker.ask = NumericHelper.to_d(output['lowestAsk'])
|
38
|
+
ticker.bid = NumericHelper.to_d(output['highestBid'])
|
39
|
+
ticker.last = NumericHelper.to_d(output['last'])
|
40
|
+
ticker.high = NumericHelper.to_d(output['high24hr'])
|
41
|
+
ticker.low = NumericHelper.to_d(output['low24hr'])
|
42
|
+
ticker.volume = NumericHelper.to_d(output['quoteVolume'])
|
43
|
+
ticker.timestamp = Time.now.to_i
|
44
|
+
ticker.payload = output
|
45
|
+
ticker
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Gate
|
3
|
+
module Services
|
4
|
+
class OrderBook < Cryptoexchange::Services::Market
|
5
|
+
class << self
|
6
|
+
def supports_individual_ticker_query?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch(market_pair)
|
12
|
+
output = super(ticker_url(market_pair))
|
13
|
+
adapt(output, market_pair)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ticker_url(market_pair)
|
17
|
+
"#{Cryptoexchange::Exchanges::Gate::Market::API_URL}/orderBook/#{market_pair.base}_#{market_pair.target}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt(output, market_pair)
|
21
|
+
order_book = Cryptoexchange::Models::OrderBook.new
|
22
|
+
|
23
|
+
order_book.base = market_pair.base
|
24
|
+
order_book.target = market_pair.target
|
25
|
+
order_book.market = Gate::Market::NAME
|
26
|
+
order_book.asks = adapt_orders output['asks']
|
27
|
+
order_book.bids = adapt_orders output['bids']
|
28
|
+
order_book.timestamp = Time.now.to_i
|
29
|
+
order_book.payload = output
|
30
|
+
order_book
|
31
|
+
end
|
32
|
+
|
33
|
+
def adapt_orders(orders)
|
34
|
+
orders.collect do |order_entry|
|
35
|
+
price, amount = order_entry
|
36
|
+
Cryptoexchange::Models::Order.new(price: price,
|
37
|
+
amount: amount,
|
38
|
+
timestamp: Time.now.to_i)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Gate
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Gate::Market::API_URL}/pairs"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
output.map do |pair|
|
14
|
+
base, target = pair.split('_')
|
15
|
+
Cryptoexchange::Models::MarketPair.new(
|
16
|
+
base: base,
|
17
|
+
target: target,
|
18
|
+
market: Gate::Market::NAME
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Gate
|
3
|
+
module Services
|
4
|
+
class Trades < Cryptoexchange::Services::Market
|
5
|
+
def fetch(market_pair)
|
6
|
+
output = super(ticker_url(market_pair))
|
7
|
+
adapt(output, market_pair)
|
8
|
+
end
|
9
|
+
|
10
|
+
def ticker_url(market_pair)
|
11
|
+
"#{Cryptoexchange::Exchanges::Gate::Market::API_URL}/tradeHistory/#{market_pair.base}_#{market_pair.target}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def adapt(output, market_pair)
|
15
|
+
output['data'].collect do |trade|
|
16
|
+
tr = Cryptoexchange::Models::Trade.new
|
17
|
+
tr.base = market_pair.base
|
18
|
+
tr.target = market_pair.target
|
19
|
+
tr.market = Gate::Market::NAME
|
20
|
+
tr.trade_id = trade['tradeID']
|
21
|
+
tr.type = trade['type']
|
22
|
+
tr.price = trade['rate']
|
23
|
+
tr.amount = trade['amount']
|
24
|
+
tr.timestamp = trade['timestamp'].to_i
|
25
|
+
tr.payload = trade
|
26
|
+
tr
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Kucoin
|
3
|
+
module Services
|
4
|
+
class Market < Cryptoexchange::Services::Market
|
5
|
+
class << self
|
6
|
+
def supports_individual_ticker_query?
|
7
|
+
false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch
|
12
|
+
output = super ticker_url
|
13
|
+
adapt_all(output)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ticker_url
|
17
|
+
"#{Cryptoexchange::Exchanges::Kucoin::Market::API_URL}/open/tick"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt_all(output)
|
21
|
+
output['data'].map do |ticker|
|
22
|
+
base, target = ticker['symbol'].split('-')
|
23
|
+
market_pair = Cryptoexchange::Models::MarketPair.new(
|
24
|
+
base: base,
|
25
|
+
target: target,
|
26
|
+
market: Kucoin::Market::NAME
|
27
|
+
)
|
28
|
+
adapt(ticker, market_pair)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def adapt(output, market_pair)
|
33
|
+
market = output
|
34
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
35
|
+
ticker.base = market_pair.base
|
36
|
+
ticker.target = market_pair.target
|
37
|
+
ticker.market = Kucoin::Market::NAME
|
38
|
+
ticker.ask = NumericHelper.to_d(market['sell'])
|
39
|
+
ticker.bid = NumericHelper.to_d(market['buy'])
|
40
|
+
ticker.last = NumericHelper.to_d(market['lastDealPrice'])
|
41
|
+
ticker.high = NumericHelper.to_d(market['high'])
|
42
|
+
ticker.low = NumericHelper.to_d(market['low'])
|
43
|
+
ticker.volume = NumericHelper.to_d(market['vol'])
|
44
|
+
ticker.timestamp = market['datetime'].to_i / 1000
|
45
|
+
ticker.payload = market
|
46
|
+
ticker
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Kucoin
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Kucoin::Market::API_URL}/market/open/symbols"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
pairs = []
|
14
|
+
output['data'].each do |data|
|
15
|
+
base, target = data['symbol'].split('-')
|
16
|
+
pairs << Cryptoexchange::Models::MarketPair.new(
|
17
|
+
base: base,
|
18
|
+
target: target,
|
19
|
+
market: Kucoin::Market::NAME
|
20
|
+
)
|
21
|
+
end
|
22
|
+
pairs
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module StocksExchange
|
3
|
+
module Services
|
4
|
+
class Market < Cryptoexchange::Services::Market
|
5
|
+
class << self
|
6
|
+
def supports_individual_ticker_query?
|
7
|
+
false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch
|
12
|
+
output = super(self.ticker_url)
|
13
|
+
adapt_all(output)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ticker_url
|
17
|
+
"#{Cryptoexchange::Exchanges::StocksExchange::Market::API_URL}/ticker"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt_all(output)
|
21
|
+
output.map do |pair|
|
22
|
+
base, target = pair['market_name'].split('_')
|
23
|
+
market_pair = Cryptoexchange::Models::MarketPair.new(
|
24
|
+
base: base,
|
25
|
+
target: target,
|
26
|
+
market: StocksExchange::Market::NAME
|
27
|
+
)
|
28
|
+
adapt(pair, market_pair)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def adapt(output, market_pair)
|
33
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
34
|
+
ticker.base = market_pair.base
|
35
|
+
ticker.target = market_pair.target
|
36
|
+
ticker.market = StocksExchange::Market::NAME
|
37
|
+
ticker.last = NumericHelper.to_d(output['last'])
|
38
|
+
ticker.bid = NumericHelper.to_d(output['bid'])
|
39
|
+
ticker.ask = NumericHelper.to_d(output['ask'])
|
40
|
+
ticker.high = NumericHelper.to_d(output['high'])
|
41
|
+
ticker.low = NumericHelper.to_d(output['low'])
|
42
|
+
ticker.volume = NumericHelper.to_d(output['vol'])
|
43
|
+
ticker.timestamp = output['updated_time']
|
44
|
+
ticker.payload = output
|
45
|
+
ticker
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module StocksExchange
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::StocksExchange::Market::API_URL}/markets"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
output.map do |pair|
|
14
|
+
Cryptoexchange::Models::MarketPair.new(
|
15
|
+
base: pair['currency'],
|
16
|
+
target: pair['partner'],
|
17
|
+
market: StocksExchange::Market::NAME
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
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.16.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-11-
|
11
|
+
date: 2017-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -187,6 +187,9 @@ files:
|
|
187
187
|
- lib/cryptoexchange/exchanges/bitcoin_indonesia/market.rb
|
188
188
|
- lib/cryptoexchange/exchanges/bitcoin_indonesia/services/market.rb
|
189
189
|
- lib/cryptoexchange/exchanges/bitcoin_indonesia/services/pairs.rb
|
190
|
+
- lib/cryptoexchange/exchanges/bitconnect/market.rb
|
191
|
+
- lib/cryptoexchange/exchanges/bitconnect/services/market.rb
|
192
|
+
- lib/cryptoexchange/exchanges/bitconnect/services/pairs.rb
|
190
193
|
- lib/cryptoexchange/exchanges/bitfinex/market.rb
|
191
194
|
- lib/cryptoexchange/exchanges/bitfinex/services/market.rb
|
192
195
|
- lib/cryptoexchange/exchanges/bitfinex/services/pairs.rb
|
@@ -226,6 +229,11 @@ files:
|
|
226
229
|
- lib/cryptoexchange/exchanges/ccex/market.rb
|
227
230
|
- lib/cryptoexchange/exchanges/ccex/services/market.rb
|
228
231
|
- lib/cryptoexchange/exchanges/ccex/services/pairs.rb
|
232
|
+
- lib/cryptoexchange/exchanges/cex/market.rb
|
233
|
+
- lib/cryptoexchange/exchanges/cex/services/market.rb
|
234
|
+
- lib/cryptoexchange/exchanges/cex/services/order_book.rb
|
235
|
+
- lib/cryptoexchange/exchanges/cex/services/pairs.rb
|
236
|
+
- lib/cryptoexchange/exchanges/cex/services/trades.rb
|
229
237
|
- lib/cryptoexchange/exchanges/chbtc/chbtc.yml
|
230
238
|
- lib/cryptoexchange/exchanges/chbtc/market.rb
|
231
239
|
- lib/cryptoexchange/exchanges/chbtc/services/market.rb
|
@@ -262,6 +270,11 @@ files:
|
|
262
270
|
- lib/cryptoexchange/exchanges/exmo/services/order_book.rb
|
263
271
|
- lib/cryptoexchange/exchanges/exmo/services/pairs.rb
|
264
272
|
- lib/cryptoexchange/exchanges/exmo/services/trades.rb
|
273
|
+
- lib/cryptoexchange/exchanges/gate/market.rb
|
274
|
+
- lib/cryptoexchange/exchanges/gate/services/market.rb
|
275
|
+
- lib/cryptoexchange/exchanges/gate/services/order_book.rb
|
276
|
+
- lib/cryptoexchange/exchanges/gate/services/pairs.rb
|
277
|
+
- lib/cryptoexchange/exchanges/gate/services/trades.rb
|
265
278
|
- lib/cryptoexchange/exchanges/gatecoin/market.rb
|
266
279
|
- lib/cryptoexchange/exchanges/gatecoin/services/market.rb
|
267
280
|
- lib/cryptoexchange/exchanges/gatecoin/services/pairs.rb
|
@@ -293,6 +306,9 @@ files:
|
|
293
306
|
- lib/cryptoexchange/exchanges/kraken/market.rb
|
294
307
|
- lib/cryptoexchange/exchanges/kraken/services/market.rb
|
295
308
|
- lib/cryptoexchange/exchanges/kraken/services/pairs.rb
|
309
|
+
- lib/cryptoexchange/exchanges/kucoin/market.rb
|
310
|
+
- lib/cryptoexchange/exchanges/kucoin/services/market.rb
|
311
|
+
- lib/cryptoexchange/exchanges/kucoin/services/pairs.rb
|
296
312
|
- lib/cryptoexchange/exchanges/lakebtc/market.rb
|
297
313
|
- lib/cryptoexchange/exchanges/lakebtc/services/market.rb
|
298
314
|
- lib/cryptoexchange/exchanges/lakebtc/services/pairs.rb
|
@@ -335,6 +351,9 @@ files:
|
|
335
351
|
- lib/cryptoexchange/exchanges/quoine/market.rb
|
336
352
|
- lib/cryptoexchange/exchanges/quoine/services/market.rb
|
337
353
|
- lib/cryptoexchange/exchanges/quoine/services/pairs.rb
|
354
|
+
- lib/cryptoexchange/exchanges/stocks_exchange/market.rb
|
355
|
+
- lib/cryptoexchange/exchanges/stocks_exchange/services/market.rb
|
356
|
+
- lib/cryptoexchange/exchanges/stocks_exchange/services/pairs.rb
|
338
357
|
- lib/cryptoexchange/exchanges/szzc/market.rb
|
339
358
|
- lib/cryptoexchange/exchanges/szzc/services/market.rb
|
340
359
|
- lib/cryptoexchange/exchanges/szzc/services/pairs.rb
|