mycoins 0.3.3 → 0.3.4
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mycoins.rb +15 -12
- metadata +6 -6
- 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: 81094f6de11121c276fa8bd1039820aec9783736
|
4
|
+
data.tar.gz: 2396fe1349594814d82360abe4ba713820dbb93f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c616ce1a054d8cf5bab8b38af96bfb715e19555ffc0daefbb2877ff3d3ceb174584b258d75b88dde2b5c4a0e1a0f6350f82a7e514dda9bbf3c2cf62db1d15ef
|
7
|
+
data.tar.gz: bf1a81b0e3c4f1d8e1637062e40a5405478209e655da423f0ea09e6dc9e01781498f60ee182d57609d3cd372de49efa13defeea82d92ff9c81c53f90568ec648
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/mycoins.rb
CHANGED
@@ -7,6 +7,7 @@ require 'cryptocoin_fanboi'
|
|
7
7
|
|
8
8
|
|
9
9
|
class MyCoins
|
10
|
+
include Colour
|
10
11
|
|
11
12
|
attr_accessor :mycurrency
|
12
13
|
|
@@ -139,6 +140,7 @@ class MyCoins
|
|
139
140
|
end
|
140
141
|
|
141
142
|
btc_val = ((total_value * rate) / btc).round(4)
|
143
|
+
|
142
144
|
|
143
145
|
h = {
|
144
146
|
title: title,
|
@@ -188,8 +190,7 @@ class MyCoins
|
|
188
190
|
rank: coin.rank.to_i,
|
189
191
|
qty: "%.2f" % x.qty,
|
190
192
|
btc_price: "%.5f" % x.btc_price,
|
191
|
-
paid: "%.0f" % paid
|
192
|
-
value_usd: "%.0f" % value_usd
|
193
|
+
paid: "%.0f" % paid
|
193
194
|
}
|
194
195
|
|
195
196
|
mycurrency = if @mycurrency and @mycurrency != 'USD' then
|
@@ -211,15 +212,15 @@ class MyCoins
|
|
211
212
|
value = (local_value || value_usd)
|
212
213
|
|
213
214
|
h2 = {
|
214
|
-
roi: "
|
215
|
-
pct_roi: "
|
215
|
+
roi: "%s" % (value - paid).round(2),
|
216
|
+
pct_roi: "%s" % (100 / (paid / (value - paid))).round(2)
|
216
217
|
}
|
217
218
|
|
218
219
|
r << h.merge!(h2)
|
219
220
|
|
220
221
|
end
|
221
222
|
|
222
|
-
end
|
223
|
+
end
|
223
224
|
|
224
225
|
def fetch_symbols(coin_names)
|
225
226
|
|
@@ -251,7 +252,7 @@ class MyCoins
|
|
251
252
|
|
252
253
|
fields = line.split('|')
|
253
254
|
|
254
|
-
a2 = fields[-3..-1].map {|x| x
|
255
|
+
a2 = fields[-3..-1].map {|x| c(x) }
|
255
256
|
(fields[0..-4] + a2 ).join('|')
|
256
257
|
|
257
258
|
end
|
@@ -265,8 +266,8 @@ class MyCoins
|
|
265
266
|
coins.reverse! if order_by == :rank
|
266
267
|
|
267
268
|
labels = %w(Name Rank Qty btc_price) \
|
268
|
-
+ ["paid
|
269
|
-
labels << "value
|
269
|
+
+ ["paid:"]
|
270
|
+
labels << "value:" if @mycurrency
|
270
271
|
labels += ['ROI:', 'ROI (%):']
|
271
272
|
|
272
273
|
puts 'labels: ' + labels.inspect if @debug
|
@@ -275,13 +276,15 @@ class MyCoins
|
|
275
276
|
out << "last_updated: %s\n\n" % r.datetime
|
276
277
|
|
277
278
|
out << format_table(coins, labels: labels)
|
279
|
+
|
280
|
+
out << "\nNote: paid and value columns displayed in " + @mycurrency
|
278
281
|
|
279
282
|
out << "\n\nInvested: %.2f %s" % [r.invested, @mycurrency]
|
280
|
-
out << "\n\nGross profit:
|
281
|
-
[r.gross_profit, @mycurrency, r.pct_gross_profit]
|
283
|
+
out << "\n\nGross profit: %s %s (%s)" % \
|
284
|
+
[c(r.gross_profit), @mycurrency, c(r.pct_gross_profit.to_s + "%")]
|
282
285
|
out << "\nLosses: %.2f %s (%.2f%%)" % [r.losses, @mycurrency, r.pct_losses]
|
283
|
-
out << "\n\nNet profit:
|
284
|
-
r.pct_net_profit]
|
286
|
+
out << "\n\nNet profit: %s %s (%s)" % [c(r.net_profit), @mycurrency,
|
287
|
+
c(r.pct_net_profit.to_s + "%")]
|
285
288
|
out << "\nCurrent value: %.2f %s (%s BTC)" % [r.value, @mycurrency,
|
286
289
|
r.btc_value]
|
287
290
|
out
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mycoins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
sCz5KsiHA9vj8OfrxhYrEb+ML4+J28Umdki7V1vgnQWmnI+Ok2SWlkScgzcmGXF6
|
31
31
|
TJ4=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-03-
|
33
|
+
date: 2018-03-10 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: dynarex
|
@@ -58,20 +58,20 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.5'
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.
|
64
|
+
version: 0.5.0
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: '0.
|
71
|
+
version: '0.5'
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.
|
74
|
+
version: 0.5.0
|
75
75
|
description:
|
76
76
|
email: james@jamesrobertson.eu
|
77
77
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|