watchcow 0.1.8 → 0.1.9

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: 6a0718f42c796d1a35cb38cb4d8b39ba6be25f4df90560814221387d0acda252
4
- data.tar.gz: 21149de4cf61d958108efb17d4df03351bbc23020723e57de95771a4fbc9804d
3
+ metadata.gz: 99751f179eb4c15e3b19d81e778b8fb6c3c99e5582fb51ce0130aaa8ab436b8d
4
+ data.tar.gz: d78b9d8c59613ca84e186c5a2ff783fb68817fb32ec0aa2ff727a88b213f346a
5
5
  SHA512:
6
- metadata.gz: 620dee957ac2f95633b1605bb54814b20f179fe3758fc04f9657598584ce51ad322b3582e377b0c8e8a4684be5f69e8ee321093caf3576ac9a093078e38eddaf
7
- data.tar.gz: c70cd9a8539d07a3bed5862c847ef5db683615d545bcb7387979bc293119f67beba996a551c19232697857ecec2e8829a471b6cdccac4886acfac29bdf826ad8
6
+ metadata.gz: 75ef29d231100e343af3879050df3945dafe1e30fab0a5dd9d5e998e4595144e963264d87585c238fb0916198d942f984612b01e610645f5da67c63ef33b2302
7
+ data.tar.gz: 18f09893ef9c952b124f79f119379c0a16bcb86b2b60e9a022b2ac0f61c49a202ddcf4f28ce6ba1743e824e8988171befbfb23640504f16aa5073896444ea8fd
data/.gitignore CHANGED
@@ -6,6 +6,6 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
-
9
+ /lib/cow.rb
10
10
  # rspec failure tracking
11
11
  .rspec_status
@@ -44,6 +44,8 @@ module Watchcow
44
44
  annual margin: #{x.dig('margin')}%
45
45
  landed margin: #{x.dig('real_margin_expected')}%
46
46
  dm bid: #{x.dig('dm_first_bid')}, spot bid: #{x.dig('spot_first_bid')}
47
+ ---
48
+
47
49
  CONTENT
48
50
  puts t
49
51
  end
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) > 0 ? self.days_remain_of(coin, t) : 1
25
+ days_remain = self.days_remain_of(coin, t)
26
26
  rescue
27
27
  redo
28
28
  end
@@ -60,11 +60,10 @@ module Watchcow
60
60
  def days_remain_of symbol, t
61
61
  @contract_info ||= Watchcow::ContractInfo.call
62
62
  line = @contract_info.dig('data').select do |h|
63
- # mark = t == 'cq' ? 'quarter' : 'next_quarter'
64
- # h.dig('symbol') == symbol.upcase && h.dig('contract_type') == mark
65
63
  h.dig('symbol') == symbol.upcase && h.dig('contract_type') == KEYS[t]
66
64
  end.first
67
- (line.dig("delivery_date").to_s.to_date - Time.now.to_date).to_i
65
+ contract_time = "#{line.dig("delivery_date").to_date.to_s} 16:00".in_time_zone('Asia/Chongqing').to_time
66
+ ((contract_time - Time.now.to_time) / 1.hours) / 24
68
67
  end
69
68
  end
70
69
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Watchcow
4
- VERSION = "0.1.8"
4
+ VERSION = "0.1.9"
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.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - DrinE Liu