watchcow 0.0.8 → 0.1.4

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: f68067affe43ba8f13442ef5d8d26bf2b5a4baf441baeabea15ca35caee8abcc
4
- data.tar.gz: 724b3b7c74be7ec4f3a760372b264f66fc23e6c1c9784d206c20a1fcaccdbf4f
3
+ metadata.gz: b9be8072f67eb62cbc4b7cf1ba09f62d336121edd4190cf0cf8c90c5a72bda52
4
+ data.tar.gz: ff1d7c9ec0a90d00f591a097240192b2b971e6dbece3e8fea816a313f15551ae
5
5
  SHA512:
6
- metadata.gz: 3c680b39a2544d5416edcde25deab194654b1cfe8d8ba2f7431712139032c9e4dd1c3ea2cbde691a72df0c1329d5dafcdca9baaaec61ce4e182cfce617c5e9d1
7
- data.tar.gz: e0bf02ae041a6f187b37436525249ed7e786c0defa92e7de959d035cc9009176d4a4c99ef3144298880b3d15ab0dfcb9af30f6f63db103966d0d5f3d1a1cc55b
6
+ metadata.gz: 2f16346c204fe851b6d09c42c69e6fe38fb4a98bf29f2ba877650d17f72f6f477dbdd0d8732715b3a9d8488a44cc14a4e5cc353c88fd36a874641375391dcd8c
7
+ data.tar.gz: 8fd9836528fc159891f4889b964b5a5bfb3eeca1ed490fc62c5f2d9b0ce04fa6d928bb0a47ceda1745f2b6e580bd4aacf937a619650e37d5134534c2abf2e9e9
@@ -7,8 +7,8 @@ require 'watchcow/rate'
7
7
  module Watchcow
8
8
  class Client
9
9
  class << self
10
- def call
11
- results = Watchcow::Rate.call
10
+ def call(coin=nil)
11
+ results = Watchcow::Rate.call(coin)
12
12
  cq_list = results[:cq_list]
13
13
  nq_list = results[:nq_list]
14
14
  nw_list = results[:nw_list]
@@ -21,6 +21,47 @@ module Watchcow
21
21
  }
22
22
  results.to_json
23
23
  end
24
+
25
+ def stare coin
26
+ while true
27
+ list_text(JSON.parse(call(coin)))
28
+ end
29
+ end
30
+
31
+ def list_text results
32
+ cq = results.dig('cq_list')
33
+ nq = results.dig('nq_list')
34
+ cw = results.dig('cw_list')
35
+ nw = results.dig('nw_list')
36
+ best_cq = cq.first
37
+ best_nq = nq.first
38
+ best_cw = cw.first
39
+ best_nw = nw.first
40
+ text = [best_nq, best_cq, best_nw, best_cw].each do |x|
41
+ t =
42
+ <<-CONTENT
43
+ #{x.dig('coin')}
44
+ remained: #{x.dig('days')}
45
+ annual margin: #{x.dig('margin')}%
46
+ expected margin: #{x.dig('expected_margin')}%
47
+ landed margin: #{x.dig('real_margin_expected')}%
48
+ first dm bid: #{x.dig('dm_first_bid')}
49
+ first spot bid: #{x.dig('spot_first_bid')}
50
+
51
+ CONTENT
52
+ puts t
53
+ end
54
+ end
55
+
56
+ def all_text results
57
+ results.map do |k, v|
58
+ v.map do |c|
59
+ c.values.map{|x| x}
60
+ end
61
+ end.inject(&:+).map do |str|
62
+ "<p>#{str}</p>"
63
+ end
64
+ end
24
65
  end
25
66
  end
26
67
  end
data/lib/watchcow/rate.rb CHANGED
@@ -9,9 +9,10 @@ module Watchcow
9
9
  'cw' => 'this_week'
10
10
  }
11
11
  class << self
12
- def call
12
+ def call coin=nil
13
13
  results = []
14
- Watchcow::ApiSymbol.contract_list.each do |coin|
14
+ coin_list = coin.nil? ? Watchcow::ApiSymbol.contract_list : [coin]
15
+ coin_list.each do |coin|
15
16
  Watchcow::ApiSymbol.dm_types.each do |t|
16
17
  dm_symbol = {symbol: "#{coin}_#{t}"}
17
18
  spot_symbol = {symbol: "#{coin}usdt"}
@@ -37,7 +38,9 @@ module Watchcow
37
38
  margin: margin_annual,
38
39
  days: days_remain,
39
40
  expected_margin: margin_expect,
40
- real_margin_expected: real_margin_expect
41
+ real_margin_expected: real_margin_expect,
42
+ dm_first_bid: dm_first_bid,
43
+ spot_first_bid: spot_first_bid
41
44
  }
42
45
  results.push(result)
43
46
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Watchcow
4
- VERSION = "0.0.8"
4
+ VERSION = "0.1.4"
5
5
  end
Binary file
Binary file
Binary file
data/watchcow.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  # spec.add_dependency "redis", '~> 3.3', ">= 3.3.5"
33
33
  # spec.add_dependency "sidekiq", '~> 5.2', ">= 5.2.9"
34
34
  spec.add_dependency "pry-rails", "~> 0.3.9"
35
-
35
+
36
36
  # For more information and examples about making a new gem, checkout our
37
37
  # guide at: https://bundler.io/guides/creating_gem.html
38
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watchcow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - DrinE Liu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-17 00:00:00.000000000 Z
11
+ date: 2021-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -67,13 +67,15 @@ files:
67
67
  - lib/watchcow/client.rb
68
68
  - lib/watchcow/contract_info.rb
69
69
  - lib/watchcow/market_depth.rb
70
- - lib/watchcow/output.rb
71
70
  - lib/watchcow/rate.rb
72
71
  - lib/watchcow/version.rb
73
72
  - watchcow-0.0.2.gem
74
73
  - watchcow-0.0.3.gem
75
74
  - watchcow-0.0.4.gem
76
75
  - watchcow-0.0.5.gem
76
+ - watchcow-0.0.6.gem
77
+ - watchcow-0.0.7.gem
78
+ - watchcow-0.0.9.gem
77
79
  - watchcow.gemspec
78
80
  homepage: https://rubygems.org/gems
79
81
  licenses:
@@ -1,10 +0,0 @@
1
- # module Watchcow
2
- # class Output
3
- # class << self
4
- # def call text
5
- # path = File.expand_path('~/', __FILE__)
6
- # File.open("#{path}/info.html", 'w+'){|f| f.write(text)}
7
- # end
8
- # end
9
- # end
10
- # end