cryptoexchange 0.15.1 → 0.15.2
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/PULL_REQUEST_TEMPLATE +2 -2
- data/README.md +3 -1
- data/lib/cryptoexchange/exchanges/abucoins/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/abucoins/services/market.rb +39 -0
- data/lib/cryptoexchange/exchanges/abucoins/services/order_book.rb +45 -0
- data/lib/cryptoexchange/exchanges/abucoins/services/pairs.rb +24 -0
- data/lib/cryptoexchange/exchanges/abucoins/services/trades.rb +32 -0
- data/lib/cryptoexchange/exchanges/exmo/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/exmo/services/market.rb +50 -0
- data/lib/cryptoexchange/exchanges/exmo/services/order_book.rb +44 -0
- data/lib/cryptoexchange/exchanges/exmo/services/pairs.rb +29 -0
- data/lib/cryptoexchange/exchanges/exmo/services/trades.rb +32 -0
- data/lib/cryptoexchange/exchanges/mercatox/services/market.rb +1 -1
- data/lib/cryptoexchange/version.rb +1 -1
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1a26929f5c499323c06cc8f2855e6dfd8f5a869
|
4
|
+
data.tar.gz: 60a0c2198df1a22e9f0b302e1242f99f43cd01ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 752a7eeca4f2d9ac7075b2f75f059acc10f048aa01924ad633c2db298b5a4992a7c284344bdf317d19c458a712a737235e2951352b360028fa88dee01449e8b5
|
7
|
+
data.tar.gz: 34e1abd1f3a6c61e048801e4de0e30d49953374bb3fe1002299cfdee2784545dd178ce1da9a69cb82e9809853dca56be376e95b589636b3bc205f07950cd38df
|
data/PULL_REQUEST_TEMPLATE
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
- What is the purpose of this Pull Request?
|
3
3
|
- What is the related issue for this Pull Request?
|
4
4
|
- [ ] I have added Specs
|
5
|
-
- [ ] (If implementing Market Ticker) I have verified that the `volume`
|
6
|
-
- [ ] (If implementing Market Ticker) I have verified that the `base` and `target` is
|
5
|
+
- [ ] (If implementing Market Ticker) I have verified that the `volume` refers to BASE
|
6
|
+
- [ ] (If implementing Market Ticker) I have verified that the `base` and `target` is assigned correctly
|
7
7
|
|
8
8
|
|
data/README.md
CHANGED
@@ -24,7 +24,8 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
| Exchange | Ticker | Order Book | Trade | Account | Market List |
|
26
26
|
| ----------------- | ------- | ---------- | ------- | ------- | ----------- |
|
27
|
-
|
|
27
|
+
| Abucoins | Y | Y | Y | | Y |
|
28
|
+
| Allcoin | Y | Y | | | User-Defined|
|
28
29
|
| ANX | Y | | | | User-Defined|
|
29
30
|
| Bit-Z | Y | | | | Y |
|
30
31
|
| Binance | Y | Y | | | User-Defined|
|
@@ -52,6 +53,7 @@ Or install it yourself as:
|
|
52
53
|
| Coinone | Y | | | | Y |
|
53
54
|
| Cryptopia | Y | | | | Y |
|
54
55
|
| EtherDelta | Y | | | | Y |
|
56
|
+
| Exmo | Y | Y | Y | | Y |
|
55
57
|
| Gatecoin | Y | | | | Y |
|
56
58
|
| GDAX | Y | | | | Y |
|
57
59
|
| Gemini | Y | Y | Y | | Y |
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Abucoins
|
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::Abucoins::Market::API_URL}/products/#{market_pair.base}-#{market_pair.target}/ticker"
|
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
|
+
|
25
|
+
ticker.base = base
|
26
|
+
ticker.target = target
|
27
|
+
ticker.market = Abucoins::Market::NAME
|
28
|
+
ticker.ask = NumericHelper.to_d(output['ask'])
|
29
|
+
ticker.bid = NumericHelper.to_d(output['bid'])
|
30
|
+
ticker.last = NumericHelper.to_d(output['price'])
|
31
|
+
ticker.volume = NumericHelper.to_d(output['volume'])
|
32
|
+
ticker.timestamp = DateTime.parse(output['time']).strftime("%s").to_i
|
33
|
+
ticker.payload = output
|
34
|
+
ticker
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Abucoins
|
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::Abucoins::Market::API_URL}/products/#{market_pair.base}-#{market_pair.target}/book?level=0"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt(output, market_pair)
|
21
|
+
order_book = Cryptoexchange::Models::OrderBook.new
|
22
|
+
timestamp = Time.now.to_i
|
23
|
+
|
24
|
+
order_book.base = market_pair.base
|
25
|
+
order_book.target = market_pair.target
|
26
|
+
order_book.market = Abucoins::Market::NAME
|
27
|
+
order_book.asks = adapt_orders output['asks']
|
28
|
+
order_book.bids = adapt_orders output['bids']
|
29
|
+
order_book.timestamp = timestamp
|
30
|
+
order_book.payload = output
|
31
|
+
order_book
|
32
|
+
end
|
33
|
+
|
34
|
+
def adapt_orders(orders)
|
35
|
+
orders.collect do |order_entry|
|
36
|
+
price, amount = order_entry
|
37
|
+
Cryptoexchange::Models::Order.new(price: price,
|
38
|
+
amount: amount,
|
39
|
+
timestamp: nil)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Abucoins
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Abucoins::Market::API_URL}/products"
|
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['base_currency'],
|
16
|
+
target: pair['quote_currency'],
|
17
|
+
market: Abucoins::Market::NAME
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Abucoins
|
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::Abucoins::Market::API_URL}/products/#{market_pair.base}-#{market_pair.target}/trades"
|
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['trade_id']
|
18
|
+
tr.base = market_pair.base
|
19
|
+
tr.target = market_pair.target
|
20
|
+
tr.type = trade['side']
|
21
|
+
tr.price = trade['price']
|
22
|
+
tr.amount = trade['size']
|
23
|
+
tr.timestamp = Time.now.to_i
|
24
|
+
tr.payload = trade
|
25
|
+
tr.market = Abucoins::Market::NAME
|
26
|
+
tr
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Exmo
|
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::Exmo::Market::API_URL}/ticker"
|
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: Exmo::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 = Exmo::Market::NAME
|
37
|
+
ticker.ask = NumericHelper.to_d(output['sell_price'])
|
38
|
+
ticker.bid = NumericHelper.to_d(output['buy_price'])
|
39
|
+
ticker.last = NumericHelper.to_d(output['last_trade'])
|
40
|
+
ticker.high = NumericHelper.to_d(output['high'])
|
41
|
+
ticker.low = NumericHelper.to_d(output['low'])
|
42
|
+
ticker.volume = NumericHelper.to_d(output['vol']) # the total value of all deals within the last 24 hours
|
43
|
+
ticker.timestamp = output['updated']
|
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 Exmo
|
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::Exmo::Market::API_URL}/order_book/?pair=#{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 = Exmo::Market::NAME
|
26
|
+
order_book.asks = adapt_orders output.values.first['ask']
|
27
|
+
order_book.bids = adapt_orders output.values.first['bid']
|
28
|
+
order_book.timestamp = Time.now.to_i
|
29
|
+
order_book.payload = output.values.first
|
30
|
+
order_book
|
31
|
+
end
|
32
|
+
|
33
|
+
def adapt_orders(orders)
|
34
|
+
orders.collect do |order_entry|
|
35
|
+
price, quantity, amount = order_entry
|
36
|
+
Cryptoexchange::Models::Order.new(price: price,
|
37
|
+
amount: quantity,
|
38
|
+
timestamp: Time.now.to_i)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Exmo
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Exmo::Market::API_URL}/pair_settings"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
pairs = output.keys
|
14
|
+
market_pairs = []
|
15
|
+
pairs.each do |pair|
|
16
|
+
base, target = pair.split('_')
|
17
|
+
market_pairs << Cryptoexchange::Models::MarketPair.new(
|
18
|
+
base: base,
|
19
|
+
target: target,
|
20
|
+
market: Exmo::Market::NAME
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
market_pairs
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Exmo
|
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::Exmo::Market::API_URL}/trades/?pair=#{market_pair.base}_#{market_pair.target}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def adapt(output, market_pair)
|
15
|
+
output.values.first.collect do |trade|
|
16
|
+
tr = Cryptoexchange::Models::Trade.new
|
17
|
+
tr.trade_id = trade['trade_id']
|
18
|
+
tr.base = market_pair.base
|
19
|
+
tr.target = market_pair.target
|
20
|
+
tr.type = trade['type']
|
21
|
+
tr.price = trade['price']
|
22
|
+
tr.amount = trade['amount']
|
23
|
+
tr.timestamp = trade['date']
|
24
|
+
tr.payload = trade
|
25
|
+
tr.market = Exmo::Market::NAME
|
26
|
+
tr
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -40,7 +40,7 @@ module Cryptoexchange::Exchanges
|
|
40
40
|
ticker.ask = NumericHelper.to_d(output['lowestAsk'])
|
41
41
|
ticker.high = NumericHelper.to_d(output['high24hr'])
|
42
42
|
ticker.low = NumericHelper.to_d(output['low24hr'])
|
43
|
-
ticker.volume = NumericHelper.to_d(output['
|
43
|
+
ticker.volume = NumericHelper.to_d(output['baseVolume'])
|
44
44
|
ticker.timestamp = Time.now.to_i
|
45
45
|
ticker.payload = output
|
46
46
|
ticker
|
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.15.
|
4
|
+
version: 0.15.2
|
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-10
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -158,6 +158,11 @@ files:
|
|
158
158
|
- cryptoexchange.gemspec
|
159
159
|
- lib/cryptoexchange.rb
|
160
160
|
- lib/cryptoexchange/client.rb
|
161
|
+
- lib/cryptoexchange/exchanges/abucoins/market.rb
|
162
|
+
- lib/cryptoexchange/exchanges/abucoins/services/market.rb
|
163
|
+
- lib/cryptoexchange/exchanges/abucoins/services/order_book.rb
|
164
|
+
- lib/cryptoexchange/exchanges/abucoins/services/pairs.rb
|
165
|
+
- lib/cryptoexchange/exchanges/abucoins/services/trades.rb
|
161
166
|
- lib/cryptoexchange/exchanges/allcoin/allcoin.yml
|
162
167
|
- lib/cryptoexchange/exchanges/allcoin/market.rb
|
163
168
|
- lib/cryptoexchange/exchanges/allcoin/services/market.rb
|
@@ -247,6 +252,11 @@ files:
|
|
247
252
|
- lib/cryptoexchange/exchanges/ether_delta/market.rb
|
248
253
|
- lib/cryptoexchange/exchanges/ether_delta/services/market.rb
|
249
254
|
- lib/cryptoexchange/exchanges/ether_delta/services/pairs.rb
|
255
|
+
- lib/cryptoexchange/exchanges/exmo/market.rb
|
256
|
+
- lib/cryptoexchange/exchanges/exmo/services/market.rb
|
257
|
+
- lib/cryptoexchange/exchanges/exmo/services/order_book.rb
|
258
|
+
- lib/cryptoexchange/exchanges/exmo/services/pairs.rb
|
259
|
+
- lib/cryptoexchange/exchanges/exmo/services/trades.rb
|
250
260
|
- lib/cryptoexchange/exchanges/gatecoin/market.rb
|
251
261
|
- lib/cryptoexchange/exchanges/gatecoin/services/market.rb
|
252
262
|
- lib/cryptoexchange/exchanges/gatecoin/services/pairs.rb
|