capwatch 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1948bc7ce49d8876cac71b83efadf1614338e50
4
- data.tar.gz: 21cc5c7ce8e803633586e33cf72c603bd228a12a
3
+ metadata.gz: '0738f16327b16bad213476d3690e3db1cc5d8228'
4
+ data.tar.gz: fdc60450e9b2bcc2f739629d17244121b5891709
5
5
  SHA512:
6
- metadata.gz: 077e0e4685f19bf2e9ba99f99293879c501afccc0c0410ab2fb1a8d74508fbd02a002b75f4c58b7459671c6f5491ed7ea1f51013d90b5081165f93b396eba431
7
- data.tar.gz: 909f0362a1623819a41d3024a1d9263436655fa525dfb27965b3d0bdcac0da4cf0a03ffe26c6cbf54065151493c2c63b79c10f636f497fcf68e4efff6465eda1
6
+ metadata.gz: cff96cadf7c3cf85feeeeab33e845865c52d6965ee6d2bb432b87f0c741ecfa8cd68ab36df474840520ee906f6158ae50c48cede2ed2b352a07a9142837a481b
7
+ data.tar.gz: e2e7d8dabdf3c2854b495f6d14ed41905655fd809edbf87c2ffcdab0cd5634fed4c74648caa159698894f559275ccfb18fc7221f9dcee25c7e840e8d9214593f
@@ -1,5 +1,5 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4.1
5
- before_install: gem install bundler -v 1.15.1
4
+ - 2.4.2
5
+ before_install: gem install bundler
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
 
14
14
  spec.summary = "Cryptoportfolio watch"
15
15
  spec.description = "Watches your cryptoportfolio"
16
- spec.homepage = "https://cryptowatch.one"
16
+ spec.homepage = "https://bugaiov.com"
17
17
  spec.license = "MIT"
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -14,6 +14,12 @@ trap("SIGINT") {
14
14
 
15
15
  if options.telegram
16
16
  Telegram.new(options.telegram).start
17
+ elsif options.all
18
+ loop do
19
+ system("clear")
20
+ puts List::watch
21
+ sleep options.tick
22
+ end
17
23
  else
18
24
  loop do
19
25
  config = Fund::Config.new
@@ -25,5 +31,3 @@ else
25
31
  sleep options.tick
26
32
  end
27
33
  end
28
-
29
-
@@ -12,4 +12,5 @@ require "capwatch/exchange"
12
12
  require "capwatch/cli"
13
13
  require "capwatch/coin"
14
14
  require "capwatch/console"
15
+ require "capwatch/list"
15
16
  require "capwatch/telegram"
@@ -8,11 +8,14 @@ module Capwatch
8
8
 
9
9
  def self.parse(args)
10
10
  options = OpenStruct.new
11
- options.tick = 60 * 5
11
+ options.tick = 60
12
12
  opt_parser = OptionParser.new do |opts|
13
13
  opts.on("-t", "--tick [Integer]", Integer, "Tick Interval") do |t|
14
14
  options.tick = t
15
15
  end
16
+ opts.on("-a", "--[no-]all", "Show All Cryptocurrencies") do |t|
17
+ options.all = t
18
+ end
16
19
  opts.on("-e", "--telegram-token=", String) do |val|
17
20
  options.telegram = val
18
21
  end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Capwatch
4
+ class List
5
+
6
+ def self.format(response, limit: 50)
7
+ response.first(limit).map do |coin|
8
+ [
9
+ coin["name"],
10
+ Console::Formatter.format_usd(coin["price_usd"]),
11
+ Console::Formatter.condition_color(Console::Formatter.format_percent(coin["percent_change_24h"])),
12
+ Console::Formatter.condition_color(Console::Formatter.format_percent(coin["percent_change_7d"]))
13
+ ]
14
+ end
15
+ end
16
+
17
+ def self.watch
18
+ response = Providers::CoinMarketCap.new.fetched_json
19
+ body = format(response)
20
+ table = Terminal::Table.new do |t|
21
+ t.style = {
22
+ # border_top: false,
23
+ border_bottom: false,
24
+ border_y: "",
25
+ border_i: "",
26
+ padding_left: 1,
27
+ padding_right: 1
28
+ }
29
+ t.headings = [
30
+ "SYMBOL",
31
+ "PRICE",
32
+ "24H %",
33
+ "7D %"
34
+ ]
35
+ body.each { |x| t << x }
36
+ end
37
+
38
+ table
39
+ end
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Capwatch
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.5"
5
5
  end
data/todo.md ADDED
@@ -0,0 +1,2 @@
1
+ # TODO
2
+ - [ ] Add https://www.cryptocompare.com/ as a provider
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capwatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Bugaiov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-25 00:00:00.000000000 Z
11
+ date: 2017-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: terminal-table
@@ -149,6 +149,7 @@ files:
149
149
  - lib/capwatch/exchange.rb
150
150
  - lib/capwatch/fund.rb
151
151
  - lib/capwatch/fund/config.rb
152
+ - lib/capwatch/list.rb
152
153
  - lib/capwatch/providers/coin_market_cap.rb
153
154
  - lib/capwatch/telegram.rb
154
155
  - lib/capwatch/version.rb
@@ -157,7 +158,8 @@ files:
157
158
  - lib/funds/extreme.json
158
159
  - lib/templates/cap.erb
159
160
  - lib/templates/watch.erb
160
- homepage: https://cryptowatch.one
161
+ - todo.md
162
+ homepage: https://bugaiov.com
161
163
  licenses:
162
164
  - MIT
163
165
  metadata: {}
@@ -177,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
179
  version: '0'
178
180
  requirements: []
179
181
  rubyforge_project:
180
- rubygems_version: 2.6.11
182
+ rubygems_version: 2.6.13
181
183
  signing_key:
182
184
  specification_version: 4
183
185
  summary: Cryptoportfolio watch