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: 4d68db2e28dc81a1083e37083f761bd8b04a95be
4
- data.tar.gz: 7d416e4cf1a42bce2fcb75ac7bba9ca00af68d4f
3
+ metadata.gz: a05f102d14e9eec8b52e69649aa624c1bcf3511d
4
+ data.tar.gz: 3a44c9bf3d2371804fd1f9a14d982b54753577df
5
5
  SHA512:
6
- metadata.gz: 9d8e9978a21bcd7a285f4d0cad9d9287ece0b84af2b0428df52e337828e203e97d1b03858d83725ac10f17252a4620991e6a3dba3a390991c64cae809afb598c
7
- data.tar.gz: 44ea8261152dc01a184f5d5cddb28bcfd391e9f3ddbb0cc1642eab6585dece4146ffd297fe320356a8b2f896f90f6bf77ee76f2ae122a4a734a70660ed7f584a
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, HTTP::TimeoutError, JSON::ParserError
11
- return { error: "#{exchange}'s service is temporarily unavailable." }
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, HTTP::TimeoutError, JSON::ParserError
30
- return { error: "#{exchange}'s service is temporarily unavailable." }
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
@@ -1,3 +1,3 @@
1
1
  module Cryptoexchange
2
- VERSION = "0.18.2"
2
+ VERSION = "0.18.3"
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.18.2
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-08 00:00:00.000000000 Z
11
+ date: 2018-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler