cryptoexchange 0.17.1 → 0.18.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: 3bf943982b7cb4d5f61a435b74316ab68e20c8fd
4
- data.tar.gz: d1072edb24bb7c559c13409dad7f4934f603fe3e
3
+ metadata.gz: 079d7cc6d1ecec984fa116728c6d16ea1c38e324
4
+ data.tar.gz: 9e0a28207e677861b05fe2c627256f2c83ed104a
5
5
  SHA512:
6
- metadata.gz: 80663402c49fb5d50b781bcd202ec27f7b78ea6c338d8d50b70dca400daeae47cdc5688cee5096caff250b7350a04231e3142173bd32e4a5d11f2db97cb50b98
7
- data.tar.gz: e2c93937e009961afed31c72eefbaf04c1e4602ec9f2b4bc25b86ba75e36ab070a8086210f5c5a75641cc2070e3538c18c5fad92a188702c1b65e47e729f625d
6
+ metadata.gz: f9292a34278274f11f700fecdae91884fedf17eedb69f9d8bc69160f42874503b5e30ba26b341ec53e4d6065b4555f468abf447a5218379fe8a3717b6d87ab5d
7
+ data.tar.gz: a8c0f4ad0c43c2f2465809fb7ced1971818135580e4f10a26e05737947389b1ac6aa0b40c912aecb311a54b12e338cbc03b0c5e5023390d9df52afc9a38c6a03
data/README.md CHANGED
@@ -56,6 +56,7 @@ Or install it yourself as:
56
56
  | Coinone | Y | | | | Y |
57
57
  | CoinsMarkets | Y | | | | Y |
58
58
  | COSS | Y | | | | Y |
59
+ | CryptoBridge | Y | | | | Y |
59
60
  | Cryptopia | Y | | | | Y |
60
61
  | EtherDelta | Y | | | | Y |
61
62
  | Exmo | Y | Y | Y | | Y |
@@ -0,0 +1,8 @@
1
+ module Cryptoexchange::Exchanges
2
+ module CryptoBridge
3
+ class Market
4
+ NAME = 'crypto_bridge'
5
+ API_URL = 'https://api.crypto-bridge.org/api/v1'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,48 @@
1
+ module Cryptoexchange::Exchanges
2
+ module CryptoBridge
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::CryptoBridge::Market::API_URL}/ticker"
18
+ end
19
+
20
+ def adapt_all(output)
21
+ output.map do |pair|
22
+ base, target = pair['id'].split('_')
23
+ market_pair = Cryptoexchange::Models::MarketPair.new(
24
+ base: base,
25
+ target: target,
26
+ market: CryptoBridge::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 = CryptoBridge::Market::NAME
37
+ ticker.ask = NumericHelper.to_d(output['ask'])
38
+ ticker.bid = NumericHelper.to_d(output['bid'])
39
+ ticker.last = NumericHelper.to_d(output['last'])
40
+ ticker.volume = NumericHelper.to_d(output['volume']) / ticker.last
41
+ ticker.timestamp = Time.now.to_i
42
+ ticker.payload = output
43
+ ticker
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,25 @@
1
+ module Cryptoexchange::Exchanges
2
+ module CryptoBridge
3
+ module Services
4
+ class Pairs < Cryptoexchange::Services::Pairs
5
+ PAIRS_URL = "#{Cryptoexchange::Exchanges::CryptoBridge::Market::API_URL}/ticker"
6
+
7
+ def fetch
8
+ output = super
9
+ adapt(output)
10
+ end
11
+
12
+ def adapt(output)
13
+ output.collect do |pair|
14
+ base, target = pair["id"].split("_")
15
+ Cryptoexchange::Models::MarketPair.new(
16
+ base: base,
17
+ target: target,
18
+ market: CryptoBridge::Market::NAME
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Cryptoexchange
2
- VERSION = "0.17.1"
2
+ VERSION = "0.18.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.17.1
4
+ version: 0.18.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-12-14 00:00:00.000000000 Z
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -266,6 +266,9 @@ files:
266
266
  - lib/cryptoexchange/exchanges/coss/market.rb
267
267
  - lib/cryptoexchange/exchanges/coss/services/market.rb
268
268
  - lib/cryptoexchange/exchanges/coss/services/pairs.rb
269
+ - lib/cryptoexchange/exchanges/crypto_bridge/market.rb
270
+ - lib/cryptoexchange/exchanges/crypto_bridge/services/market.rb
271
+ - lib/cryptoexchange/exchanges/crypto_bridge/services/pairs.rb
269
272
  - lib/cryptoexchange/exchanges/cryptopia/market.rb
270
273
  - lib/cryptoexchange/exchanges/cryptopia/services/market.rb
271
274
  - lib/cryptoexchange/exchanges/cryptopia/services/pairs.rb