cryptocoin_fanboi 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/cryptocoin_fanboi.rb +44 -10
- data.tar.gz.sig +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2ea507a04381ea847547b11a0802abbc38bc884
|
4
|
+
data.tar.gz: ad0444638682f8e4b7ef57845514d6a10cba6ab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d21443b5a274fb3422052bc196b321e17a81d9be728e94707ccbb36ba473d0c258d68cccdeb6bae57474fdc654041b1beab3a097aeb240bc89ad64d886ab88d
|
7
|
+
data.tar.gz: 16a1f4d539ed3f101df42f10597da4ef83ce8cc89630d010eeb0398552b8bbc70893ebf0eaf25face638fd9e03ce2afac608d654b38e76ac922ddf0c45e1704f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/cryptocoin_fanboi.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# file: cryptocoin_fanboi
|
3
|
+
# file: cryptocoin_fanboi.rb
|
4
4
|
|
5
5
|
|
6
6
|
require 'coinmarketcap'
|
@@ -14,9 +14,11 @@ class CryptocoinFanboi
|
|
14
14
|
def initialize(watch: [])
|
15
15
|
|
16
16
|
@watch = watch.map(&:upcase)
|
17
|
-
|
18
|
-
@
|
19
|
-
|
17
|
+
|
18
|
+
@fields = %w(rank name price_usd price_btc percent_change_1h
|
19
|
+
percent_change_24h percent_change_7d)
|
20
|
+
|
21
|
+
@labels = %w(Rank Name USD BTC) + ['% 1hr:', '% 24hr:', '% 1 week:']
|
20
22
|
@coins = fetch_coinlist(watch: @watch)
|
21
23
|
|
22
24
|
end
|
@@ -27,17 +29,43 @@ class CryptocoinFanboi
|
|
27
29
|
|
28
30
|
alias abbreviations coin_abbreviations
|
29
31
|
|
30
|
-
|
32
|
+
|
33
|
+
# View the coins with the largest gains in the past hour
|
34
|
+
#
|
35
|
+
def now(limit: 5, markdown: false)
|
36
|
+
|
37
|
+
TableFormatter.new(source: top_coins('1h', limit: limit),
|
38
|
+
labels: @labels, markdown: markdown).display
|
39
|
+
end
|
40
|
+
|
41
|
+
# View the coins with the largest gains this week (past 7 days)
|
42
|
+
#
|
43
|
+
def this_week(limit: 5, markdown: false)
|
44
|
+
|
45
|
+
TableFormatter.new(source: top_coins(limit: limit),
|
46
|
+
labels: @labels, markdown: markdown).display
|
47
|
+
#top_coins(limit: limit)
|
48
|
+
end
|
49
|
+
|
50
|
+
alias week this_week
|
51
|
+
|
52
|
+
# View the coins with the largest gains today (past 24 hours)
|
53
|
+
#
|
54
|
+
def today(limit: 5, markdown: false)
|
55
|
+
|
56
|
+
TableFormatter.new(source: top_coins('24h', limit: limit),
|
57
|
+
labels: @labels, markdown: markdown).display
|
58
|
+
end
|
59
|
+
|
60
|
+
def to_s(limit: nil, markdown: false, watch: @watch)
|
31
61
|
|
32
|
-
coins = fetch_coinlist(limit: limit, watch:
|
62
|
+
coins = fetch_coinlist(limit: limit, watch: watch).map do |coin|
|
33
63
|
|
34
|
-
|
35
|
-
percent_change_24h percent_change_7d).map {|x| coin[x] }
|
64
|
+
@fields.map {|x| coin[x] }
|
36
65
|
|
37
66
|
end
|
38
67
|
|
39
|
-
|
40
|
-
@tfo.display markdown: markdown
|
68
|
+
TableFormatter.new(source: coins, labels: @labels, markdown: markdown).display
|
41
69
|
|
42
70
|
end
|
43
71
|
|
@@ -50,6 +78,12 @@ class CryptocoinFanboi
|
|
50
78
|
limit ? coins.take(limit) : coins
|
51
79
|
|
52
80
|
end
|
81
|
+
|
82
|
+
def top_coins(period='7d', limit: 5)
|
83
|
+
|
84
|
+
@coins.sort_by {|x| -x['percent_change_' + period].to_f}.take(limit).map \
|
85
|
+
{|coin| @fields.map {|x| coin[x] }}
|
86
|
+
end
|
53
87
|
|
54
88
|
end
|
55
89
|
|
data.tar.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
�QH
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptocoin_fanboi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
NgmsFfw10oaD3PWQ7UPxWJP14au2LUL+NGHkLrGHOMPphsZhYeXKugGO8NfcKukq
|
31
31
|
fps=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-01-
|
33
|
+
date: 2018-01-02 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: coinmarketcap
|
metadata.gz.sig
CHANGED
Binary file
|