cryptoexchange 0.18.2 → 0.18.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a05f102d14e9eec8b52e69649aa624c1bcf3511d
|
4
|
+
data.tar.gz: 3a44c9bf3d2371804fd1f9a14d982b54753577df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4841f3b05cee7641a3eda64e7517afbeacfce63acf60edd3beb8761fe78c9a5e0c89bb2e18b137fef20dc91607f1e0fd0c698792763cae06533286138d6201ba
|
7
|
+
data.tar.gz: 9c208e3cf1c390314c8067b9843509902474cb73a11bd8ab98808584926406dcd5293fff797343cd93d5b19f88fbcd4147c728baad94de705b92f85808b5731d
|
@@ -7,8 +7,14 @@ module Cryptoexchange
|
|
7
7
|
def pairs(exchange)
|
8
8
|
pairs_classname = "Cryptoexchange::Exchanges::#{StringHelper.camelize(exchange)}::Services::Pairs"
|
9
9
|
Object.const_get(pairs_classname).new.fetch
|
10
|
-
rescue HTTP::ConnectionError
|
11
|
-
return { error: "#{exchange}'s service
|
10
|
+
rescue HTTP::ConnectionError => e
|
11
|
+
return { error: "#{exchange}'s service has connection error", message: e.to_s }
|
12
|
+
rescue HTTP::TimeoutError => e
|
13
|
+
return { error: "#{exchange}'s service time out", message: e.to_s }
|
14
|
+
rescue JSON::ParserError => e
|
15
|
+
return { error: "#{exchange}'s service does not send JSON", message: e.to_s }
|
16
|
+
rescue TypeError => e
|
17
|
+
return { error: "#{exchange}'s service does not respond with right format", message: e.to_s }
|
12
18
|
end
|
13
19
|
|
14
20
|
def ticker(market_pair)
|
@@ -26,8 +32,14 @@ module Cryptoexchange
|
|
26
32
|
t.target.casecmp(market_pair.target) == 0
|
27
33
|
end
|
28
34
|
end
|
29
|
-
rescue HTTP::ConnectionError
|
30
|
-
return { error: "#{exchange}'s service
|
35
|
+
rescue HTTP::ConnectionError => e
|
36
|
+
return { error: "#{exchange}'s service has connection error", message: e.to_s }
|
37
|
+
rescue HTTP::TimeoutError => e
|
38
|
+
return { error: "#{exchange}'s service time out", message: e.to_s }
|
39
|
+
rescue JSON::ParserError => e
|
40
|
+
return { error: "#{exchange}'s service does not send JSON", message: e.to_s }
|
41
|
+
rescue TypeError => e
|
42
|
+
return { error: "#{exchange}'s service does not respond with right format", message: e.to_s }
|
31
43
|
end
|
32
44
|
|
33
45
|
def available_exchanges
|
@@ -46,7 +46,7 @@ module Cryptoexchange::Exchanges
|
|
46
46
|
ticker.bid = NumericHelper.to_d(ticker_output['bid'])
|
47
47
|
ticker.ask = NumericHelper.to_d(ticker_output['ask'])
|
48
48
|
ticker.last = NumericHelper.to_d(ticker_output['lastPrice'])
|
49
|
-
ticker.volume = NumericHelper.to_d(ticker_output['volume24H'])
|
49
|
+
ticker.volume = NumericHelper.divide(NumericHelper.to_d(ticker_output['volume24H']), ticker.last)
|
50
50
|
ticker.timestamp = Time.now.to_i
|
51
51
|
ticker.payload = ticker_output
|
52
52
|
ticker
|
@@ -35,7 +35,7 @@ module Cryptoexchange::Exchanges
|
|
35
35
|
|
36
36
|
def adapt_orders(orders, timestamp)
|
37
37
|
orders.collect do |order_entry|
|
38
|
-
Cryptoexchange::Models::Order.new(price: NumericHelper.to_d(order_entry["price"]),
|
38
|
+
Cryptoexchange::Models::Order.new(price: NumericHelper.to_d(order_entry["price"].abs),
|
39
39
|
amount: NumericHelper.to_d(order_entry["volume"]),
|
40
40
|
timestamp: timestamp)
|
41
41
|
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.18.
|
4
|
+
version: 0.18.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TM Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|