abot-whitelist 0.1.0 → 0.2.0

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: f8d096025944adc5c7c4dd674f96eea9886bc1a36687da0a7064f4ddbeb0d3ff
4
- data.tar.gz: ef946a8ba024db803aac412b3c9fc6e4300f466af926533f1b422302671a9e10
3
+ metadata.gz: 87bf91fb9d03999272df0b4acac7cdaa84388253b42cb4c42730289095ccea4b
4
+ data.tar.gz: 13664637d383cc08486b67df9d257e15d156b4f712f225722eae949dc2f76845
5
5
  SHA512:
6
- metadata.gz: d4672433ba0a62ccb14f0ab2376ac3b489f02abd43592f5319851346e3594f3c236bdb31a7bb8484b1d773689c5cd39964fb8e9364978a9c05f5a6b68a437466
7
- data.tar.gz: d4a7c2f736ad90b32ffe4c7c8d67a14fc62761394047ed7d82b5d5bb5a6b04cfa8aed7f73f4ff2d4abd57d26e30f1f784c9388942c0ba82a81474c03e84d1a99
6
+ metadata.gz: 123fff02723291bae6eeca4d8ec8bfc6bc21bc74f23d1b171884555451702d33fe57fad9d21529b350b37b91b99a1a469854d3444e630afbba83954447cda359
7
+ data.tar.gz: 86f9135baf85bd8df12ffc3b2c66ee980114ed35555cc86fbe9084597318dae1692588505e151123e86e8f91259393e4fbd0895a88c2b2d7f6a62c09ba3d26ab
data/Gemfile CHANGED
@@ -1,7 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'activerecord', '~> 6.1.3'
4
- # gem 'paint', '~> 2.2.1'
5
- # gem 'sqlite3', '~> 1.4.2'
6
- # gem 'terminal-table', '~> 3.0.1'
7
4
  gem 'binance-ruby', '~> 1.3.1'
@@ -16,14 +16,13 @@ Gem::Specification.new do |spec|
16
16
  spec.files = Dir['lib/**/*.rb', 'exe/*'] + %w[
17
17
  abot-whitelist.gemspec
18
18
  Gemfile
19
- LICENSE
20
19
  Rakefile
21
20
  README.md
22
21
  ]
23
22
 
24
23
  spec.test_files = Dir['spec/**/*_spec.rb']
25
24
 
26
- spec.extra_rdoc_files = %w[LICENSE README.md]
25
+ spec.extra_rdoc_files = %w[README.md]
27
26
 
28
27
  spec.bindir = 'exe'
29
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -6,8 +6,9 @@ module Abot
6
6
  class BinanceCap
7
7
  include HTTParty
8
8
 
9
- DEFAULT_COINS = %w[ONE UNFI]
10
- FIAT = %w[USDT BUSD AUD BIDR BRL EUR GBR RUB TRY TUSD USDC DAI IDRT PAX UAH NGN VAI BVND]
9
+ DEFAULT_COINS = %w[ONE UNFI SOL].freeze
10
+ FIAT = %w[USDT BUSD AUD BIDR BRL EUR GBR RUB TRY TUSD USDC DAI IDRT PAX UAH NGN VAI BVND].freeze
11
+ BLACK_LIST = %w[FUN XVS AION BTC].freeze
11
12
 
12
13
  class << self
13
14
  def send_req(base_list:, top_number:)
@@ -21,10 +22,17 @@ module Abot
21
22
  private
22
23
 
23
24
  def process!(response:, base_list:, top_number:)
24
- result = top(response: response, top_number: top_number).map { |m| base_list.include?(m) ? m : nil }.compact
25
- puts "base list: #{base_list}"
26
- puts "+++++++++++++++++++++++++++++++++++++++++++++"
27
- puts "coins (count = #{result.count}) from the base list in the top #{top_number} by capitalization:"
25
+ result = top(response: response, top_number: top_number)
26
+ if base_list
27
+ result = result.map { |m| base_list.include?(m) ? m : nil }.compact
28
+
29
+ puts "base list: #{base_list}"
30
+ puts '+++++++++++++++++++++++++++++++++++++++++++++'
31
+ puts "coins (count = #{result.count}) from the base list in the top #{top_number} by capitalization:"
32
+ else
33
+ puts "coins (count = #{result.count}) in the top #{top_number} by capitalization:"
34
+ end
35
+
28
36
  puts result.join(' ')
29
37
  end
30
38
 
@@ -33,7 +41,7 @@ module Abot
33
41
  .sort_by { |s| s[1] }
34
42
  .reverse
35
43
  .map { |m| m[0] }
36
- result = (all_coins - FIAT)[0..((top_number - 1) - DEFAULT_COINS.count)]
44
+ result = (all_coins - FIAT - BLACK_LIST)[0..((top_number - 1) - DEFAULT_COINS.count)]
37
45
  result + DEFAULT_COINS
38
46
  end
39
47
 
@@ -1,5 +1,5 @@
1
1
  module Abot
2
2
  module Whitelist
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -4,8 +4,6 @@ require 'active_record'
4
4
  require 'binance-ruby'
5
5
 
6
6
  require_relative 'whitelist/option_parser'
7
- # require_relative 'whitelist/coin'
8
- # require_relative 'whitelist/binance_account'
9
7
  require_relative 'whitelist/binance_cap'
10
8
  require_relative 'whitelist/version'
11
9
 
@@ -22,8 +20,7 @@ module Abot
22
20
 
23
21
  parser.add_option(
24
22
  :list_number, '--list_number=number',
25
- 'Порядковый номер списка',
26
- required: true
23
+ 'Порядковый номер списка'
27
24
  )
28
25
 
29
26
  parser.add_option(
@@ -35,10 +32,9 @@ module Abot
35
32
  list_number = Whitelist::OptionParser.instance.options[:list_number].to_i
36
33
  top_number = (Whitelist::OptionParser.instance.options[:top] || 100).to_i
37
34
 
38
- raise 'list_number is wrong' unless list_number.positive?
39
35
  raise 'top is wrong' unless top_number.positive?
40
36
 
41
- base_list = Abot::Whitelist::BaseWhitelist.base_whitelist(list_number: list_number)
37
+ base_list = Abot::Whitelist::BaseWhitelist.base_whitelist(list_number: list_number) if list_number.positive?
42
38
  BinanceCap.send_req(base_list: base_list, top_number: top_number)
43
39
  end
44
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abot-whitelist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - w_dmitrii
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-12 00:00:00.000000000 Z
11
+ date: 2021-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,11 +87,9 @@ executables:
87
87
  - abot-whitelist
88
88
  extensions: []
89
89
  extra_rdoc_files:
90
- - LICENSE
91
90
  - README.md
92
91
  files:
93
92
  - Gemfile
94
- - LICENSE
95
93
  - README.md
96
94
  - Rakefile
97
95
  - abot-whitelist.gemspec
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2021 w_dmitrii
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.