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
@@ -18,18 +18,18 @@ module Cryptoexchange::Exchanges
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def adapt(output)
|
21
|
-
ticker
|
22
|
-
ticker.base
|
23
|
-
ticker.target
|
24
|
-
ticker.market
|
25
|
-
ticker.ask
|
26
|
-
ticker.bid
|
27
|
-
ticker.last
|
28
|
-
ticker.high
|
29
|
-
ticker.low
|
30
|
-
ticker.volume
|
31
|
-
ticker.timestamp = output['timestamp']
|
32
|
-
ticker.payload
|
21
|
+
ticker = Coincheck::Models::Ticker.new
|
22
|
+
ticker.base = 'BTC'
|
23
|
+
ticker.target = 'JPY'
|
24
|
+
ticker.market = Coincheck::Market::NAME
|
25
|
+
ticker.ask = NumericHelper.to_d(output['ask'])
|
26
|
+
ticker.bid = NumericHelper.to_d(output['bid'])
|
27
|
+
ticker.last = NumericHelper.to_d(output['last'])
|
28
|
+
ticker.high = NumericHelper.to_d(output['high'])
|
29
|
+
ticker.low = NumericHelper.to_d(output['low'])
|
30
|
+
ticker.volume = NumericHelper.to_d(output['volume'])
|
31
|
+
ticker.timestamp = output['timestamp'].to_i
|
32
|
+
ticker.payload = output
|
33
33
|
ticker
|
34
34
|
end
|
35
35
|
end
|
@@ -19,16 +19,16 @@ module Cryptoexchange::Exchanges
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def adapt(output)
|
22
|
-
ticker
|
23
|
-
ticker.base
|
24
|
-
ticker.target
|
25
|
-
ticker.market
|
26
|
-
ticker.last
|
27
|
-
ticker.high
|
28
|
-
ticker.low
|
29
|
-
ticker.volume
|
30
|
-
ticker.timestamp = output['timestamp']
|
31
|
-
ticker.payload
|
22
|
+
ticker = Coinone::Models::Ticker.new
|
23
|
+
ticker.base = output['currency']
|
24
|
+
ticker.target = 'KRW'
|
25
|
+
ticker.market = Coinone::Market::NAME
|
26
|
+
ticker.last = NumericHelper.to_d(output['last'])
|
27
|
+
ticker.high = NumericHelper.to_d(output['high'])
|
28
|
+
ticker.low = NumericHelper.to_d(output['low'])
|
29
|
+
ticker.volume = NumericHelper.to_d(output['volume'])
|
30
|
+
ticker.timestamp = output['timestamp'].to_i
|
31
|
+
ticker.payload = output
|
32
32
|
ticker
|
33
33
|
end
|
34
34
|
end
|
@@ -23,19 +23,19 @@ module Cryptoexchange::Exchanges
|
|
23
23
|
data = output['Data']
|
24
24
|
base, target = data['Label'].split('/')
|
25
25
|
|
26
|
-
ticker
|
27
|
-
ticker.base
|
28
|
-
ticker.target
|
29
|
-
ticker.market
|
30
|
-
ticker.last
|
31
|
-
ticker.bid
|
32
|
-
ticker.ask
|
33
|
-
ticker.high
|
34
|
-
ticker.low
|
35
|
-
ticker.volume
|
36
|
-
ticker.change
|
37
|
-
ticker.timestamp =
|
38
|
-
ticker.payload
|
26
|
+
ticker = Cryptopia::Models::Ticker.new
|
27
|
+
ticker.base = base
|
28
|
+
ticker.target = target
|
29
|
+
ticker.market = Cryptopia::Market::NAME
|
30
|
+
ticker.last = NumericHelper.to_d(data['LastPrice'])
|
31
|
+
ticker.bid = NumericHelper.to_d(data['BidPrice'])
|
32
|
+
ticker.ask = NumericHelper.to_d(data['AskPrice'])
|
33
|
+
ticker.high = NumericHelper.to_d(data['High'])
|
34
|
+
ticker.low = NumericHelper.to_d(data['Low'])
|
35
|
+
ticker.volume = NumericHelper.to_d(data['Volume'])
|
36
|
+
ticker.change = NumericHelper.to_d(data['Change'])
|
37
|
+
ticker.timestamp = Time.now.to_i
|
38
|
+
ticker.payload = data
|
39
39
|
ticker
|
40
40
|
end
|
41
41
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'bigdecimal'
|
2
|
+
|
3
|
+
module Cryptoexchange::Exchanges
|
4
|
+
module EtherDelta
|
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
|
+
"#{Cryptoexchange::Exchanges::EtherDelta::Market::API_URL}/returnTicker"
|
20
|
+
end
|
21
|
+
|
22
|
+
def adapt(output, market_pair)
|
23
|
+
name = "#{market_pair.base}_#{market_pair.target}"
|
24
|
+
market = output[name]
|
25
|
+
|
26
|
+
ticker = EtherDelta::Models::Ticker.new
|
27
|
+
ticker.base = market_pair.base
|
28
|
+
ticker.target = market_pair.target
|
29
|
+
ticker.market = EtherDelta::Market::NAME
|
30
|
+
ticker.last = NumericHelper.to_d(market['last'].to_s)
|
31
|
+
ticker.bid = NumericHelper.to_d(market['bid'].to_s)
|
32
|
+
ticker.ask = NumericHelper.to_d(market['ask'].to_s)
|
33
|
+
ticker.volume = NumericHelper.to_d(market['quoteVolume'].to_s)
|
34
|
+
ticker.timestamp = DateTime.now.to_time.to_i
|
35
|
+
ticker.payload = market
|
36
|
+
ticker
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module EtherDelta
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::EtherDelta::Market::API_URL}/returnTicker"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
output.keys.map do |pair|
|
14
|
+
base, target = pair.split('_')
|
15
|
+
|
16
|
+
EtherDelta::Models::MarketPair.new({
|
17
|
+
base: base,
|
18
|
+
target: target,
|
19
|
+
market: EtherDelta::Market::NAME
|
20
|
+
})
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -30,18 +30,18 @@ module Cryptoexchange::Exchanges
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def adapt(output, market_pair)
|
33
|
-
ticker
|
34
|
-
ticker.base
|
35
|
-
ticker.target
|
36
|
-
ticker.market
|
37
|
-
ticker.last
|
38
|
-
ticker.bid
|
39
|
-
ticker.ask
|
40
|
-
ticker.high
|
41
|
-
ticker.low
|
42
|
-
ticker.volume
|
33
|
+
ticker = Gatecoin::Models::Ticker.new
|
34
|
+
ticker.base = market_pair.base
|
35
|
+
ticker.target = market_pair.target
|
36
|
+
ticker.market = Gatecoin::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['volume'])
|
43
43
|
ticker.timestamp = output['createDateTime'].to_i
|
44
|
-
ticker.payload
|
44
|
+
ticker.payload = output
|
45
45
|
ticker
|
46
46
|
end
|
47
47
|
end
|
@@ -35,10 +35,10 @@ module Cryptoexchange::Exchanges
|
|
35
35
|
ticker.base = market_pair.base
|
36
36
|
ticker.target = market_pair.target
|
37
37
|
ticker.market = Gemini::Market::NAME
|
38
|
-
ticker.ask =
|
39
|
-
ticker.bid =
|
40
|
-
#this is
|
41
|
-
ticker.volume =
|
38
|
+
ticker.ask = NumericHelper.to_d(output['ask'])
|
39
|
+
ticker.bid = NumericHelper.to_d(output['bid'])
|
40
|
+
# this is Base currency's volume
|
41
|
+
ticker.volume = NumericHelper.to_d(output['volume'][market_pair.base])
|
42
42
|
ticker.timestamp = output['volume']['timestamp'].to_i
|
43
43
|
ticker.payload = output
|
44
44
|
ticker
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'bigdecimal'
|
2
|
+
|
3
|
+
module Cryptoexchange::Exchanges
|
4
|
+
module Hitbtc
|
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
|
+
symbol = "#{market_pair.base}#{market_pair.target}"
|
20
|
+
|
21
|
+
"#{Cryptoexchange::Exchanges::Hitbtc::Market::API_URL}/public/#{symbol}/ticker"
|
22
|
+
end
|
23
|
+
|
24
|
+
def adapt(output, market_pair)
|
25
|
+
ticker = Hitbtc::Models::Ticker.new
|
26
|
+
ticker.base = market_pair.base
|
27
|
+
ticker.target = market_pair.target
|
28
|
+
ticker.market = Hitbtc::Market::NAME
|
29
|
+
ticker.last = NumericHelper.to_d(output['last'])
|
30
|
+
ticker.bid = NumericHelper.to_d(output['bid'])
|
31
|
+
ticker.ask = NumericHelper.to_d(output['ask'])
|
32
|
+
ticker.high = NumericHelper.to_d(output['high'])
|
33
|
+
ticker.low = NumericHelper.to_d(output['low'])
|
34
|
+
ticker.volume = NumericHelper.to_d(output['volume'])
|
35
|
+
ticker.timestamp = output['timestamp']
|
36
|
+
ticker.payload = output
|
37
|
+
ticker
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Hitbtc
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Hitbtc::Market::API_URL}/public/symbols"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
output['symbols'].map do |market|
|
14
|
+
Hitbtc::Models::MarketPair.new({
|
15
|
+
base: market['commodity'],
|
16
|
+
target: market['currency'],
|
17
|
+
market: Hitbtc::Market::NAME
|
18
|
+
})
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
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['timestamp']/1000
|
34
|
-
ticker.payload
|
23
|
+
ticker = Korbit::Models::Ticker.new
|
24
|
+
ticker.base = market_pair.base
|
25
|
+
ticker.target = market_pair.target
|
26
|
+
ticker.market = Korbit::Market::NAME
|
27
|
+
ticker.ask = NumericHelper.to_d(output['ask'])
|
28
|
+
ticker.bid = NumericHelper.to_d(output['bid'])
|
29
|
+
ticker.last = NumericHelper.to_d(output['last'])
|
30
|
+
ticker.high = NumericHelper.to_d(output['high'])
|
31
|
+
ticker.low = NumericHelper.to_d(output['low'])
|
32
|
+
ticker.volume = NumericHelper.to_d(output['volume'])
|
33
|
+
ticker.timestamp = output['timestamp'] / 1000
|
34
|
+
ticker.payload = output
|
35
35
|
ticker
|
36
36
|
end
|
37
37
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Lakebtc
|
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::Lakebtc::Market::API_URL}/ticker"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt_all(output)
|
21
|
+
tickers = []
|
22
|
+
|
23
|
+
output.keys.each do |pair|
|
24
|
+
if pair.include?('btc')
|
25
|
+
ticker_json = output[pair]
|
26
|
+
ticker = Lakebtc::Models::Ticker.new
|
27
|
+
ticker.base = 'btc'
|
28
|
+
ticker.target = pair[3..-1]
|
29
|
+
ticker.market = Lakebtc::Market::NAME
|
30
|
+
|
31
|
+
# NOTE: apparently it can be nil
|
32
|
+
ticker.ask = NumericHelper.to_d(ticker_json['ask'])
|
33
|
+
ticker.bid = NumericHelper.to_d(ticker_json['bid'])
|
34
|
+
ticker.last = NumericHelper.to_d(ticker_json['last'])
|
35
|
+
ticker.high = NumericHelper.to_d(ticker_json['high'])
|
36
|
+
ticker.low = NumericHelper.to_d(ticker_json['low'])
|
37
|
+
ticker.volume = NumericHelper.to_d(ticker_json['volume'])
|
38
|
+
|
39
|
+
ticker.timestamp = Time.now.to_i
|
40
|
+
ticker.payload = ticker_json
|
41
|
+
|
42
|
+
tickers << ticker
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
tickers
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|