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 +4 -4
- data/README.md +1 -0
- data/lib/cryptoexchange/exchanges/crypto_bridge/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/crypto_bridge/services/market.rb +48 -0
- data/lib/cryptoexchange/exchanges/crypto_bridge/services/pairs.rb +25 -0
- data/lib/cryptoexchange/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 079d7cc6d1ecec984fa116728c6d16ea1c38e324
|
4
|
+
data.tar.gz: 9e0a28207e677861b05fe2c627256f2c83ed104a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9292a34278274f11f700fecdae91884fedf17eedb69f9d8bc69160f42874503b5e30ba26b341ec53e4d6065b4555f468abf447a5218379fe8a3717b6d87ab5d
|
7
|
+
data.tar.gz: a8c0f4ad0c43c2f2465809fb7ced1971818135580e4f10a26e05737947389b1ac6aa0b40c912aecb311a54b12e338cbc03b0c5e5023390d9df52afc9a38c6a03
|
data/README.md
CHANGED
@@ -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
|
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.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-
|
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
|