capwatch 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/capwatch.gemspec +1 -1
- data/exe/capwatch +6 -2
- data/lib/capwatch.rb +1 -0
- data/lib/capwatch/cli.rb +4 -1
- data/lib/capwatch/list.rb +41 -0
- data/lib/capwatch/version.rb +1 -1
- data/todo.md +2 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0738f16327b16bad213476d3690e3db1cc5d8228'
|
4
|
+
data.tar.gz: fdc60450e9b2bcc2f739629d17244121b5891709
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cff96cadf7c3cf85feeeeab33e845865c52d6965ee6d2bb432b87f0c741ecfa8cd68ab36df474840520ee906f6158ae50c48cede2ed2b352a07a9142837a481b
|
7
|
+
data.tar.gz: e2e7d8dabdf3c2854b495f6d14ed41905655fd809edbf87c2ffcdab0cd5634fed4c74648caa159698894f559275ccfb18fc7221f9dcee25c7e840e8d9214593f
|
data/.travis.yml
CHANGED
data/capwatch.gemspec
CHANGED
@@ -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://
|
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|
|
data/exe/capwatch
CHANGED
@@ -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
|
-
|
data/lib/capwatch.rb
CHANGED
data/lib/capwatch/cli.rb
CHANGED
@@ -8,11 +8,14 @@ module Capwatch
|
|
8
8
|
|
9
9
|
def self.parse(args)
|
10
10
|
options = OpenStruct.new
|
11
|
-
options.tick = 60
|
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
|
data/lib/capwatch/version.rb
CHANGED
data/todo.md
ADDED
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
|
+
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-
|
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
|
-
|
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.
|
182
|
+
rubygems_version: 2.6.13
|
181
183
|
signing_key:
|
182
184
|
specification_version: 4
|
183
185
|
summary: Cryptoportfolio watch
|