cryptocoin_fanboi 0.5.1 → 0.5.2
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 +4 -3
- data.tar.gz.sig +0 -0
- data/lib/cryptocoin_fanboi.rb +58 -33
- 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: 663140a8278d5197c7b5442ac4dc0bdcd75e7d1b
|
4
|
+
data.tar.gz: a0a179f850ea98dba44ba691ce515e8e1a798e5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04ab6fb534cad796d482c497ef8b8e9a0f4b35ae9b14f4374bb2aa1acda8a37858b52d9130be5c5c630fa32603cf22d4759a1b92074037872a1c5de2647a5598
|
7
|
+
data.tar.gz: 1968f4e191bbd100efe75e24da4f27fd55751eab2d61e29849f9700f7b56055ad9e2c703c3c4687699873baa832090a365b082ba39281b44eb82b5c606b0b5b4
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
���
|
1
|
+
��($�腍�t=s��#�7_D�I����4�\Jp!��(�����
|
2
|
+
�B{'��jE
|
3
|
+
���S���b�5U[�"'�frXoҦ�F��ؽ��.H�!�=M�!q����0=t)��1���-�g���w��ݭܿ�������+ib��kEk�iM�ü
|
4
|
+
��0�n?�5�nf���"�O���\�m��u!>��'zq�*m�Wӕn��> MW_Zg�Q{�%���!�8W=QF5b�ܱJ)�6�u9(�m�Bw
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/cryptocoin_fanboi.rb
CHANGED
@@ -44,11 +44,11 @@ require 'justexchangerates'
|
|
44
44
|
module Colour
|
45
45
|
|
46
46
|
def colourise(x)
|
47
|
-
|
48
|
-
return x if x.to_s.strip.empty?
|
47
|
+
|
48
|
+
return x if x.to_s.strip.empty? or @colored == false
|
49
49
|
|
50
50
|
s3 = (x.to_s.sub(/[\d\.\-]+/) {|s2| "%.2f" % s2})
|
51
|
-
s = s3
|
51
|
+
s = s3.length == x.to_s.length ? s3 : s3.sub(/ /,'')
|
52
52
|
|
53
53
|
s[/^ *-/] ? s.red : s.green
|
54
54
|
end
|
@@ -72,12 +72,12 @@ class CryptocoinFanboi
|
|
72
72
|
@ignore = ignore.map(&:upcase)
|
73
73
|
|
74
74
|
@fields = %w(rank name price_usd price_btc percent_change_1h
|
75
|
-
percent_change_24h percent_change_7d)
|
75
|
+
percent_change_24h percent_change_7d percent_change_year)
|
76
76
|
|
77
77
|
@year = Time.now.year
|
78
78
|
@labels = %w(Rank Name USD BTC) + ['% 1hr:', '% 24hr:',
|
79
79
|
'% 1 week:', '% ' + @year.to_s + ':']
|
80
|
-
|
80
|
+
coins = fetch_coinlist()
|
81
81
|
|
82
82
|
# check for the local cache file containing a record of currency
|
83
83
|
# prices from the start of the year
|
@@ -113,8 +113,11 @@ class CryptocoinFanboi
|
|
113
113
|
|
114
114
|
end
|
115
115
|
|
116
|
-
@growth = fetch_growth(
|
117
|
-
puts '@growth: ' + @growth.inspect if @debug
|
116
|
+
@growth = fetch_growth(coins, @coin_prices)
|
117
|
+
puts '@growth: ' + @growth.inspect if @debug
|
118
|
+
|
119
|
+
@coins = add_year_growth coins
|
120
|
+
|
118
121
|
|
119
122
|
end
|
120
123
|
|
@@ -204,7 +207,7 @@ class CryptocoinFanboi
|
|
204
207
|
#
|
205
208
|
def now(limit: 5, markdown: false)
|
206
209
|
|
207
|
-
|
210
|
+
build_table top_coins('1h', limit: limit), markdown: markdown
|
208
211
|
|
209
212
|
end
|
210
213
|
|
@@ -290,17 +293,28 @@ class CryptocoinFanboi
|
|
290
293
|
def this_week(limit: 5, markdown: false)
|
291
294
|
|
292
295
|
coins = top_coins(limit: limit)
|
293
|
-
|
296
|
+
build_table coins, markdown: markdown
|
294
297
|
|
295
298
|
end
|
296
299
|
|
297
300
|
alias week this_week
|
298
301
|
|
302
|
+
# View the coins with the largest gains this
|
303
|
+
# year (since the start of the year)
|
304
|
+
#
|
305
|
+
def this_year(limit: 5, markdown: false)
|
306
|
+
|
307
|
+
build_table top_coins('year', limit: limit), markdown: markdown
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
alias year this_year
|
312
|
+
|
299
313
|
# View the coins with the largest gains today (past 24 hours)
|
300
314
|
#
|
301
315
|
def today(limit: 5, markdown: false)
|
302
316
|
|
303
|
-
|
317
|
+
build_table top_coins('24h', limit: limit), markdown: markdown
|
304
318
|
|
305
319
|
end
|
306
320
|
|
@@ -323,19 +337,46 @@ class CryptocoinFanboi
|
|
323
337
|
|
324
338
|
def to_s(limit: 5, markdown: false)
|
325
339
|
|
326
|
-
coins = fetch_coinlist(limit: limit)
|
340
|
+
coins = (fetch_coinlist(limit: limit))
|
341
|
+
|
342
|
+
coins2 = add_year_growth(coins)
|
343
|
+
|
344
|
+
puts 'coins2: ' + coins2.inspect
|
345
|
+
|
346
|
+
coins3 = coins2.map do |coin|
|
347
|
+
|
327
348
|
puts 'coin: ' + coin.inspect if @debug
|
328
349
|
@fields.map {|x| coin[x] }
|
329
350
|
|
330
|
-
end
|
351
|
+
end
|
352
|
+
|
353
|
+
puts 'coins3: ' + coins3.inspect if @debug
|
331
354
|
|
332
|
-
|
333
|
-
|
334
|
-
build_table coins, markdown: markdown
|
355
|
+
|
356
|
+
build_table coins3, markdown: markdown
|
335
357
|
|
336
358
|
end
|
337
359
|
|
338
360
|
private
|
361
|
+
|
362
|
+
# adds growth from the start of the year
|
363
|
+
#
|
364
|
+
def add_year_growth(coins)
|
365
|
+
|
366
|
+
coins.each do |x|
|
367
|
+
|
368
|
+
puts 'x.name: ' + x.name if @debug
|
369
|
+
|
370
|
+
if @growth.has_key?(x.name) then
|
371
|
+
x.percent_change_year = @growth[x.name].to_s
|
372
|
+
else
|
373
|
+
x.percent_change_year = '-'
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
coins
|
378
|
+
|
379
|
+
end
|
339
380
|
|
340
381
|
def build_table(a, markdown: markdown, labels: @labels)
|
341
382
|
|
@@ -344,25 +385,9 @@ class CryptocoinFanboi
|
|
344
385
|
puts 'a : ' + a.inspect
|
345
386
|
puts '@growth: ' + @growth.inspect
|
346
387
|
end
|
347
|
-
|
348
|
-
|
349
|
-
@growth.has_key?(x[1]) ? x + [@growth[x[1]].to_s] : x + ['-']
|
350
|
-
end
|
351
|
-
|
352
|
-
if @debug then
|
353
|
-
puts 'coins+growth: ' + coins.inspect
|
354
|
-
puts 'before format_table'
|
355
|
-
end
|
356
|
-
|
357
|
-
format_table(coins, markdown: markdown, labels: @labels)
|
358
|
-
end
|
359
|
-
|
360
|
-
def build_table2(a, markdown: markdown, labels: @labels)
|
361
|
-
|
362
|
-
format_table(a, markdown: markdown, labels: @labels[0..-2])
|
363
|
-
|
388
|
+
|
389
|
+
format_table(a, markdown: markdown, labels: @labels)
|
364
390
|
end
|
365
|
-
|
366
391
|
|
367
392
|
def format_table(source, markdown: markdown, labels: @labels)
|
368
393
|
|
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.5.
|
4
|
+
version: 0.5.2
|
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-
|
33
|
+
date: 2018-05-01 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: colored
|
metadata.gz.sig
CHANGED
Binary file
|