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 +4 -4
- data/.gitignore +1 -1
- data/lib/watchcow/client.rb +2 -0
- data/lib/watchcow/rate.rb +3 -4
- data/lib/watchcow/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99751f179eb4c15e3b19d81e778b8fb6c3c99e5582fb51ce0130aaa8ab436b8d
|
4
|
+
data.tar.gz: d78b9d8c59613ca84e186c5a2ff783fb68817fb32ec0aa2ff727a88b213f346a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75ef29d231100e343af3879050df3945dafe1e30fab0a5dd9d5e998e4595144e963264d87585c238fb0916198d942f984612b01e610645f5da67c63ef33b2302
|
7
|
+
data.tar.gz: 18f09893ef9c952b124f79f119379c0a16bcb86b2b60e9a022b2ac0f61c49a202ddcf4f28ce6ba1743e824e8988171befbfb23640504f16aa5073896444ea8fd
|
data/.gitignore
CHANGED
data/lib/watchcow/client.rb
CHANGED
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)
|
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
|
-
|
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
|
data/lib/watchcow/version.rb
CHANGED