mycoins 0.2.2 → 0.2.3
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 +8 -7
- 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: 8928e60128a76148d009d196ef2286ed57d50880
|
4
|
+
data.tar.gz: 85dcc24bcdd9bd1f374403f2c01483adba3822cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e82115cd34552785b099128be98d1bb6486e03f2cf89cd0b15092006b6bc713ebee09e1f5c336809995901b49ea55e0a816c41c90cb519494600d73d30e63e8c
|
7
|
+
data.tar.gz: ea5d21181fbbe559c1528870ae538c375b0e06f0698d075c13c9fcce7364c679b898472fd45a5082b578f674d16c71a2ae7d9b528faf487a04a787d33e0d74d4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/mycoins.rb
CHANGED
@@ -67,10 +67,10 @@ class MyCoins
|
|
67
67
|
@mycurrency]
|
68
68
|
end
|
69
69
|
|
70
|
-
def portfolio()
|
71
|
-
|
70
|
+
def portfolio(order_by: :rank)
|
71
|
+
|
72
72
|
r = build_portfolio(@dx.title)
|
73
|
-
format_portfolio(r)
|
73
|
+
format_portfolio(r, order_by: order_by)
|
74
74
|
|
75
75
|
end
|
76
76
|
|
@@ -94,7 +94,7 @@ class MyCoins
|
|
94
94
|
|
95
95
|
if @portfolio and \
|
96
96
|
DateTime.parse(@portfolio.datetime) + 60 > DateTime.now then
|
97
|
-
return @portfolio
|
97
|
+
return @portfolio
|
98
98
|
end
|
99
99
|
|
100
100
|
a = build_records()
|
@@ -117,7 +117,7 @@ class MyCoins
|
|
117
117
|
net_profit: sum(a, :profit).round(2)
|
118
118
|
}
|
119
119
|
|
120
|
-
@portfolio = OpenStruct.new(h)
|
120
|
+
@portfolio = OpenStruct.new(h)
|
121
121
|
|
122
122
|
end
|
123
123
|
|
@@ -173,9 +173,10 @@ class MyCoins
|
|
173
173
|
|
174
174
|
end
|
175
175
|
|
176
|
-
def format_portfolio(r)
|
176
|
+
def format_portfolio(r, order_by: :rank)
|
177
177
|
|
178
|
-
coins = r.records.sort_by{|x| x[
|
178
|
+
coins = r.records.sort_by {|x| -x[order_by].to_f}.map {|x| x.values}
|
179
|
+
coins.reverse! if order_by == :rank
|
179
180
|
|
180
181
|
labels = %w(Rank Name Qty btc_price) \
|
181
182
|
+ ["paid(#{@mycurrency}):", 'value(USD):']
|
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.2.
|
4
|
+
version: 0.2.3
|
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-01-
|
33
|
+
date: 2018-01-08 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: dynarex
|
metadata.gz.sig
CHANGED
Binary file
|