cryptoexchange 0.12.1 → 0.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 156fdba06f370689e70059e71dd2e1c08522d315
4
- data.tar.gz: 665333f735f3f0e37f3b9176816a3c83c55bdac0
3
+ metadata.gz: 8b39973d1a3262f9d928115c7a0fd83ec4a43819
4
+ data.tar.gz: e179c3925ed1e8011e6acb77d37315673b8ad07d
5
5
  SHA512:
6
- metadata.gz: 77db044066dba1f26e92847467faf3ca4c032834000dcc5892ccd28e1831ad71ebd65fb37bc8bb62a78cb5f6720ad4f91bf5e2e9e7d5fc8d4d3860a2bbcb998d
7
- data.tar.gz: f4e63848067560144e979182e4f3d2c19749c095915523c745eae578e57c53cd61f9c5abd0f2bf017350118ffb51fea95d2e670e56f8d6474441f2dfc9dae7da
6
+ metadata.gz: c220786553be7e58781c626e04e478321272b888808e61142cbf9b3566d2ab752dbed4ba2ddfc77adc08f8b501ca28ee19e5d48deb90d2d18b1d35990d5f81ca
7
+ data.tar.gz: 28b227431c6b39905dedceb6701780b8ff1f9f97bb3b8a5ad04f7e13033438de06c2dd072ff944372b4220aa71811d713340ea95084b83a3beb08247b087a09d
data/README.md CHANGED
@@ -31,6 +31,7 @@ Or install it yourself as:
31
31
  | Bitfinex | Y | | | | Y |
32
32
  | Bitflyer | Y | | | | Y |
33
33
  | Bithumb | Y | | | | Y |
34
+ | Bitkonan | Y | | | | User-Defined|
34
35
  | Bitso | Y | | | | Y |
35
36
  | Bitstamp | Y | | | | User-Defined|
36
37
  | Bittrex | Y | | | | Y |
@@ -45,7 +46,7 @@ Or install it yourself as:
45
46
  | CHBTC | Y | | | | User-Defined|
46
47
  | Coincheck | Y | | | | User-Defined|
47
48
  | CoinExchange | Y | | | | Y |
48
- | Coinmate | | | | | |
49
+ | Coinmate | Y | Y | | | User-Defined|
49
50
  | Coinone | Y | | | | Y |
50
51
  | Cryptopia | Y | | | | Y |
51
52
  | EtherDelta | Y | | | | Y |
@@ -54,7 +55,7 @@ Or install it yourself as:
54
55
  | Gemini | Y | Y | Y | | Y |
55
56
  | HitBTC | Y | | | | Y |
56
57
  | Huobi | Y | | | | Y |
57
- | Itbit | | | | | |
58
+ | Itbit | Y | | | | User-Defined|
58
59
  | Jubi | Y | | | | Y |
59
60
  | Korbit | Y | | | | User-Defined|
60
61
  | Kraken | Y | | | | Y |
@@ -70,6 +71,7 @@ Or install it yourself as:
70
71
  | QuadrigaCX | Y | | | | User-Defined|
71
72
  | Quoine | Y | | | | Y |
72
73
  | SZZC | Y | | | | Y |
74
+ | The Rock Trading | Y | | | | Y |
73
75
  | Tidex | Y | | | | Y |
74
76
  | TuxExchange | Y | | | | Y |
75
77
  | Unocoin | | | | | |
@@ -0,0 +1,5 @@
1
+ :pairs:
2
+ - :base: BTC
3
+ :target: USD
4
+ - :base: LTC
5
+ :target: USD
@@ -0,0 +1,8 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Bitkonan
3
+ class Market
4
+ NAME = 'bitkonan'
5
+ API_URL = 'https://bitkonan.com/api'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,43 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Bitkonan
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
+ if market_pair.base == 'BTC'
18
+ route = 'ticker'
19
+ elsif market_pair.base == 'LTC'
20
+ route = 'ltc_ticker'
21
+ end
22
+ "#{Cryptoexchange::Exchanges::Bitkonan::Market::API_URL}/#{route}"
23
+ end
24
+
25
+ def adapt(output, market_pair)
26
+ ticker = Cryptoexchange::Models::Ticker.new
27
+ ticker.base = market_pair.base
28
+ ticker.target = market_pair.target
29
+ ticker.market = Bitkonan::Market::NAME
30
+ ticker.ask = NumericHelper.to_d(output['ask'])
31
+ ticker.bid = NumericHelper.to_d(output['bid'])
32
+ ticker.last = NumericHelper.to_d(output['last'])
33
+ ticker.high = NumericHelper.to_d(output['high'])
34
+ ticker.low = NumericHelper.to_d(output['low'])
35
+ ticker.volume = NumericHelper.to_d(output['volume'])
36
+ ticker.timestamp = Time.now.to_i
37
+ ticker.payload = output
38
+ ticker
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,25 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Bitkonan
3
+ module Services
4
+ class Pairs < Cryptoexchange::Services::Pairs
5
+
6
+ def fetch
7
+ output = super
8
+ adapt(output)
9
+ end
10
+
11
+ def adapt(output)
12
+ market_pairs = []
13
+ output.each do |pair|
14
+ market_pairs << Cryptoexchange::Models::MarketPair.new(
15
+ base: pair[:base],
16
+ target: pair[:target],
17
+ market: Bitkonan::Market::NAME
18
+ )
19
+ end
20
+ market_pairs
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ :pairs:
2
+ - :base: BTC
3
+ :target: CZK
4
+ - :base: BTC
5
+ :target: EUR
@@ -0,0 +1,8 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Coinmate
3
+ class Market
4
+ NAME = 'coinmate'
5
+ API_URL = 'https://coinmate.io/api'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,39 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Coinmate
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.base, market_pair.target)
14
+ end
15
+
16
+ def ticker_url(market_pair)
17
+ "#{Cryptoexchange::Exchanges::Coinmate::Market::API_URL}/ticker?currencyPair=#{market_pair.base}_#{market_pair.target}"
18
+ end
19
+
20
+ def adapt(output, base, target)
21
+ ticker = Cryptoexchange::Models::Ticker.new
22
+ ticker.base = base
23
+ ticker.target = target
24
+ ticker.market = Coinmate::Market::NAME
25
+ ticker.ask = NumericHelper.to_d(output['data']['ask'])
26
+ ticker.bid = NumericHelper.to_d(output['data']['bid'])
27
+ ticker.last = NumericHelper.to_d(output['data']['last'])
28
+ ticker.high = NumericHelper.to_d(output['data']['high'])
29
+ ticker.low = NumericHelper.to_d(output['data']['low'])
30
+ ticker.volume = NumericHelper.to_d(output['data']['amount'])
31
+ ticker.timestamp = output['data']['timestamp'].to_i
32
+ ticker.payload = output
33
+ ticker
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,41 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Coinmate
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::Coinmate::Market::API_URL}/orderBook?currencyPair=#{market_pair.base}_#{market_pair.target}&groupByPriceLimit=False"
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 = Coinmate::Market::NAME
27
+ order_book.asks = adapt_orders(output['data']['asks'], timestamp)
28
+ order_book.bids = adapt_orders(output['data']['bids'], timestamp)
29
+ order_book.timestamp = timestamp
30
+ order_book.payload = output
31
+ order_book
32
+ end
33
+
34
+ def adapt_orders(orders, timestamp)
35
+ # Format as: [price, amount, timestamp]
36
+ orders.collect { |order_entry| order_entry.values << timestamp }
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,23 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Coinmate
3
+ module Services
4
+ class Pairs < Cryptoexchange::Services::Pairs
5
+
6
+ def fetch
7
+ output = super
8
+ market_pairs = []
9
+ output.each do |pair|
10
+ market_pairs << Cryptoexchange::Models::MarketPair.new(
11
+ base: pair[:base],
12
+ target: pair[:target],
13
+ market: Coinmate::Market::NAME
14
+ )
15
+ end
16
+
17
+ market_pairs
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,8 @@
1
+ :pairs:
2
+ - :base: XBT
3
+ :target: USD
4
+ - :base: XBT
5
+ :target: SGD
6
+ - :base: XBT
7
+ :target: EUR
8
+
@@ -0,0 +1,8 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Itbit
3
+ class Market
4
+ NAME = 'itbit'
5
+ API_URL = 'https://api.itbit.com/v1'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,38 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Itbit
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::Itbit::Market::API_URL}/markets/#{market_pair.base}#{market_pair.target}/ticker"
18
+ end
19
+
20
+ def adapt(output, market_pair)
21
+ ticker = Cryptoexchange::Models::Ticker.new
22
+ ticker.base = market_pair.base
23
+ ticker.target = market_pair.target
24
+ ticker.market = Itbit::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['lastPrice'])
28
+ ticker.high = NumericHelper.to_d(output['high24h'])
29
+ ticker.low = NumericHelper.to_d(output['low24h'])
30
+ ticker.volume = NumericHelper.to_d(output['volume24h'])
31
+ ticker.timestamp = DateTime.strptime(output['serverTimeUTC'],'%FT%T').to_time.to_i
32
+ ticker.payload = output
33
+ ticker
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,25 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Itbit
3
+ module Services
4
+ class Pairs < Cryptoexchange::Services::Pairs
5
+
6
+ def fetch
7
+ output = super
8
+ adapt(output)
9
+ end
10
+
11
+ def adapt(output)
12
+ market_pairs = []
13
+ output.each do |pair|
14
+ market_pairs << Cryptoexchange::Models::MarketPair.new(
15
+ base: pair[:base],
16
+ target: pair[:target],
17
+ market: Itbit::Market::NAME
18
+ )
19
+ end
20
+ market_pairs
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,8 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Therocktrading
3
+ class Market
4
+ NAME = 'therocktrading'
5
+ API_URL = 'https://www.therocktrading.com/api'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,51 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Therocktrading
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::Therocktrading::Market::API_URL}/tickers"
18
+ end
19
+
20
+ def adapt_all(output)
21
+ output['result']['tickers'].map do |pair, ticker|
22
+ base, target = pair[0,3], pair[3,6]
23
+ market_pair = Cryptoexchange::Models::MarketPair.new(
24
+ base: base,
25
+ target: target,
26
+ market: Therocktrading::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 = Therocktrading::Market::NAME
38
+ ticker.ask = NumericHelper.to_d(market['ask'])
39
+ ticker.bid = NumericHelper.to_d(market['bid'])
40
+ ticker.last = NumericHelper.to_d(market['last'])
41
+ ticker.high = NumericHelper.to_d(market['high'])
42
+ ticker.low = NumericHelper.to_d(market['low'])
43
+ ticker.volume = NumericHelper.to_d(market['volume_traded'])
44
+ ticker.timestamp = Time.now.to_i
45
+ ticker.payload = market
46
+ ticker
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,28 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Therocktrading
3
+ module Services
4
+ class Pairs < Cryptoexchange::Services::Pairs
5
+ PAIRS_URL = "#{Cryptoexchange::Exchanges::Therocktrading::Market::API_URL}/tickers"
6
+
7
+ def fetch
8
+ output = super
9
+ adapt(output)
10
+ end
11
+
12
+ def adapt(output)
13
+ market_pairs = []
14
+ tickers = output['result']['tickers']
15
+ tickers.each_key do |pair|
16
+ base, target = pair[0,3], pair[3,6]
17
+ market_pairs << Cryptoexchange::Models::MarketPair.new(
18
+ base: base,
19
+ target: target,
20
+ market: Therocktrading::Market::NAME
21
+ )
22
+ end
23
+ market_pairs
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module Cryptoexchange
2
- VERSION = "0.12.1"
2
+ VERSION = "0.13.0"
3
3
  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.12.1
4
+ version: 0.13.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-10-06 00:00:00.000000000 Z
11
+ date: 2017-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -179,6 +179,10 @@ files:
179
179
  - lib/cryptoexchange/exchanges/bithumb/market.rb
180
180
  - lib/cryptoexchange/exchanges/bithumb/services/market.rb
181
181
  - lib/cryptoexchange/exchanges/bithumb/services/pairs.rb
182
+ - lib/cryptoexchange/exchanges/bitkonan/bitkonan.yml
183
+ - lib/cryptoexchange/exchanges/bitkonan/market.rb
184
+ - lib/cryptoexchange/exchanges/bitkonan/services/market.rb
185
+ - lib/cryptoexchange/exchanges/bitkonan/services/pairs.rb
182
186
  - lib/cryptoexchange/exchanges/bitso/market.rb
183
187
  - lib/cryptoexchange/exchanges/bitso/services/market.rb
184
188
  - lib/cryptoexchange/exchanges/bitso/services/pairs.rb
@@ -216,6 +220,11 @@ files:
216
220
  - lib/cryptoexchange/exchanges/coincheck/market.rb
217
221
  - lib/cryptoexchange/exchanges/coincheck/services/market.rb
218
222
  - lib/cryptoexchange/exchanges/coincheck/services/pairs.rb
223
+ - lib/cryptoexchange/exchanges/coinmate/coinmate.yml
224
+ - lib/cryptoexchange/exchanges/coinmate/market.rb
225
+ - lib/cryptoexchange/exchanges/coinmate/services/market.rb
226
+ - lib/cryptoexchange/exchanges/coinmate/services/order_book.rb
227
+ - lib/cryptoexchange/exchanges/coinmate/services/pairs.rb
219
228
  - lib/cryptoexchange/exchanges/coinone/market.rb
220
229
  - lib/cryptoexchange/exchanges/coinone/services/market.rb
221
230
  - lib/cryptoexchange/exchanges/coinone/services/pairs.rb
@@ -242,6 +251,10 @@ files:
242
251
  - lib/cryptoexchange/exchanges/huobi/market.rb
243
252
  - lib/cryptoexchange/exchanges/huobi/services/market.rb
244
253
  - lib/cryptoexchange/exchanges/huobi/services/pairs.rb
254
+ - lib/cryptoexchange/exchanges/itbit/itbit.yml
255
+ - lib/cryptoexchange/exchanges/itbit/market.rb
256
+ - lib/cryptoexchange/exchanges/itbit/services/market.rb
257
+ - lib/cryptoexchange/exchanges/itbit/services/pairs.rb
245
258
  - lib/cryptoexchange/exchanges/jubi/market.rb
246
259
  - lib/cryptoexchange/exchanges/jubi/services/market.rb
247
260
  - lib/cryptoexchange/exchanges/jubi/services/pairs.rb
@@ -291,6 +304,9 @@ files:
291
304
  - lib/cryptoexchange/exchanges/szzc/market.rb
292
305
  - lib/cryptoexchange/exchanges/szzc/services/market.rb
293
306
  - lib/cryptoexchange/exchanges/szzc/services/pairs.rb
307
+ - lib/cryptoexchange/exchanges/therocktrading/market.rb
308
+ - lib/cryptoexchange/exchanges/therocktrading/services/market.rb
309
+ - lib/cryptoexchange/exchanges/therocktrading/services/pairs.rb
294
310
  - lib/cryptoexchange/exchanges/tidex/market.rb
295
311
  - lib/cryptoexchange/exchanges/tidex/services/market.rb
296
312
  - lib/cryptoexchange/exchanges/tidex/services/pairs.rb