watchcow 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e61b0ed76f06c66b745197e83717fab99cb28b09596ba9a09c10c0a7ad28954a
4
- data.tar.gz: 69533691b22d8c8523d7a7e8ddffc8911b7765d2b153ad8058f5d5d8a4aeb64f
3
+ metadata.gz: 6a0718f42c796d1a35cb38cb4d8b39ba6be25f4df90560814221387d0acda252
4
+ data.tar.gz: 21149de4cf61d958108efb17d4df03351bbc23020723e57de95771a4fbc9804d
5
5
  SHA512:
6
- metadata.gz: af296878de3024d07cad96fbd87be539f015bfcd6fd91634a274e9bcdc333be04c462e183cf1becac655b8317c9771c96c5fca446058c1b22147f2e9dd48c17f
7
- data.tar.gz: 73c6762912f4bcb513ed488bd08ebd1879c75a662cbcfa2608cc8900f35d6b765f6e161f7fc83571d981d4a7b7336f8ec2499bec71c669cbf164026bd209d585
6
+ metadata.gz: 620dee957ac2f95633b1605bb54814b20f179fe3758fc04f9657598584ce51ad322b3582e377b0c8e8a4684be5f69e8ee321093caf3576ac9a093078e38eddaf
7
+ data.tar.gz: c70cd9a8539d07a3bed5862c847ef5db683615d545bcb7387979bc293119f67beba996a551c19232697857ecec2e8829a471b6cdccac4886acfac29bdf826ad8
data/lib/watchcow/rate.rb CHANGED
@@ -22,7 +22,7 @@ module Watchcow
22
22
  spot_result = Watchcow::MarketDepth.call(params: spot_symbol, k: :spot)
23
23
  # puts spot_symbol.dig(:symbol)
24
24
  dm_result = JSON.parse dm_result
25
- days_remain = self.days_remain_of(coin, t)
25
+ days_remain = self.days_remain_of(coin, t) > 0 ? self.days_remain_of(coin, t) : 1
26
26
  rescue
27
27
  redo
28
28
  end
@@ -33,7 +33,6 @@ module Watchcow
33
33
  margin_expect = margin_annual / 365 * days_remain
34
34
 
35
35
  real_margin_expect = (1.0 / spot_first_bid - 1.0 / dm_first_bid) * spot_first_bid * 100
36
-
37
36
  result = {
38
37
  coin: "#{coin}_#{t}",
39
38
  margin: margin_annual,
@@ -46,14 +45,10 @@ module Watchcow
46
45
  results.push(result)
47
46
  end
48
47
  end
49
- begin
50
- results_cq = results.select{|x| x[:coin].include?('cq')}
51
- results_nq = results.select{|x| x[:coin].include?('nq')}
52
- results_cw = results.select{|x| x[:coin].include?('cw')}
53
- results_nw = results.select{|x| x[:coin].include?('nw')}
54
- rescue
55
- puts results_cq.to_json
56
- end
48
+ results_cq = results.select{|x| x[:coin].include?('cq')}
49
+ results_nq = results.select{|x| x[:coin].include?('nq')}
50
+ results_cw = results.select{|x| x[:coin].include?('cw')}
51
+ results_nw = results.select{|x| x[:coin].include?('nw')}
57
52
  {
58
53
  cq_list: results_cq.sort{|x,y| y[:expected_margin] <=> x[:expected_margin]},
59
54
  nq_list: results_nq.sort{|x,y| y[:expected_margin] <=> x[:expected_margin]},
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Watchcow
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.8"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watchcow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - DrinE Liu