mycoins 0.2.8 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0de68ec33574a524691136fb578f4cbb1fb6da40
4
- data.tar.gz: 76d834c23b04e3684fd97ea251b62aadc1aaaa35
3
+ metadata.gz: 8dd03864d00124f2122c6730fa485c89a41fb7cb
4
+ data.tar.gz: 78ac2b931792153cf94dba8634c37e0496f12f81
5
5
  SHA512:
6
- metadata.gz: 77284f5d25b3086518f58dac39d3600d45e904145fc24c06ded0f8202123cd54c8673f0886055927f946a4283f0b034df937c2112a9730afd69994575516e578
7
- data.tar.gz: '04085ac00af0dcb7244c5a6b053cbf91f7dd96abc77fb309fbda9817188072f00fd32f1388fcfc84c25348b9b0da3f6de4d3a049e61afe0d33b2d31fda5f4513'
6
+ metadata.gz: 53c5c247ca4a334aedbc18311b6438670586ffa72df322824a556dccc080dc636d1802d1f69dde145e59e4ae5be9bcbda2e373cd018391b9cb5152eec3fd4ba0
7
+ data.tar.gz: f4eaa4657597e9c255c8f4ec3bc713d9cc0b6000be98c7ebd67f6eff91ab7c662bf2e7d0ae1555eb7493b962a4fa65a38b10d29d885d1b2e8d12fc3ff522a770
checksums.yaml.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- ,ʰ�UMwU�<M2Z�h�=Dsb����Q(1����k#�;s�s����OH�{�³��/VJ�ڋcV�J*�Z�o��b������r�"Kq�=�"w�z��?��r��ڲ�B��i���� ����9h��/� ��zN��7�&9go%�Y��x���(Y@�t�<�wE�-~�d.�P���� 1&�L��p��4��<��"%��7ʘ�g��#�6N�)�n{]Ǚ<8��q�s
2
- ���=
1
+ '��7|���m6=�!&�r�ռ�CY=u�oU2 S��m�����pTГ�{�-��y���ݲ{% q���s��u��F#��P����{��C=�^R��*�?Y�QD8����yA��`����w4v�7r��mWh���.�*\�����9��p_[�7�|�¯-��K/�)�
2
+ ���%�
3
+ һY���j��F܅��f�݆~l��uR/؋���3"b�DmL�h5 3�1�f�("�祳[,δ
data.tar.gz.sig CHANGED
Binary file
data/lib/mycoins.rb CHANGED
@@ -57,7 +57,7 @@ class MyCoins
57
57
  mycoins = h.values
58
58
 
59
59
  puts 'mycoins: ' + mycoins.inspect if @debug
60
- @ccf = CryptocoinFanboi.new(watch: mycoins)
60
+ @ccf = CryptocoinFanboi.new(watch: mycoins, debug: debug)
61
61
 
62
62
  end
63
63
 
@@ -90,7 +90,8 @@ class MyCoins
90
90
  end
91
91
 
92
92
  def portfolio(order_by: :rank)
93
-
93
+
94
+ puts 'inside portfolio' if @debug
94
95
  r = build_portfolio(@dx.title)
95
96
  format_portfolio(r, order_by: order_by)
96
97
 
@@ -127,6 +128,9 @@ class MyCoins
127
128
  .map{|x| sum(x, :roi)}
128
129
  pct_gross_profit = (100 / (invested / gross_profit)).round(2)
129
130
  pct_losses = (100 / (invested / losses)).round(2)
131
+ total_value = sum(a, ('value_' + @mycurrency.downcase).to_sym)
132
+ rate = JustExchangeRates.new(base: 'GBP').rate('USD')
133
+ btc_val = (@ccf.price('bitcoin') / total_value * rate).round(4)
130
134
 
131
135
  h = {
132
136
  title: title,
@@ -134,7 +138,7 @@ class MyCoins
134
138
  records: a,
135
139
  datetime: Time.now.strftime("%d/%m/%Y at %H:%M%p"),
136
140
  invested: invested,
137
- value: sum(a, ('value_' + @mycurrency.downcase).to_sym),
141
+ value: total_value, btc_value: btc_val,
138
142
  gross_profit: gross_profit.round(2), losses: losses.round(2),
139
143
  pct_gross_profit: pct_gross_profit,
140
144
  pct_losses: pct_losses,
@@ -152,7 +156,17 @@ class MyCoins
152
156
  @dx.all.inject([]) do |r, x|
153
157
 
154
158
  puts 'x: ' + x.inspect if @debug
155
- coin = @ccf.find(x.title.gsub(/\s+\[[^\]]+\]/,''))
159
+ title = x.title.gsub(/\s+\[[^\]]+\]/,'')
160
+
161
+ if @debug then
162
+ puts 'title: ' + title.inspect
163
+ puts '@ccf: ' + @ccf.class.inspect
164
+ end
165
+
166
+ coin = @ccf.find(title)
167
+ raise 'build_records error: coin nil' if coin.nil?
168
+
169
+ puts 'coin: ' + coin.inspect if @debug
156
170
  usd_rate = coin.price_usd.to_f
157
171
 
158
172
  paid = ((x.qty.to_f * x.btc_price.to_f) * \
@@ -257,8 +271,10 @@ class MyCoins
257
271
  out << "\n\nGross profit: %.2f %s (%.2f%%)" % \
258
272
  [r.gross_profit, @mycurrency, r.pct_gross_profit]
259
273
  out << "\nLosses: %.2f %s (%.2f%%)" % [r.losses, @mycurrency, r.pct_losses]
260
- out << "\n\nNet profit: %.2f %s (%.2f%%)" % [r.net_profit, @mycurrency, r.pct_net_profit]
261
- out << "\nCurrent value: %.2f %s" % [r.value, @mycurrency]
274
+ out << "\n\nNet profit: %.2f %s (%.2f%%)" % [r.net_profit, @mycurrency,
275
+ r.pct_net_profit]
276
+ out << "\nCurrent value: %.2f %s (%s BTC)" % [r.value, @mycurrency,
277
+ r.btc_value]
262
278
  out
263
279
 
264
280
  end
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.8
4
+ version: 0.3.0
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-02-10 00:00:00.000000000 Z
33
+ date: 2018-03-08 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: dynarex
@@ -41,7 +41,7 @@ dependencies:
41
41
  version: '1.7'
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 1.7.28
44
+ version: 1.7.29
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
@@ -51,7 +51,7 @@ dependencies:
51
51
  version: '1.7'
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.7.28
54
+ version: 1.7.29
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: justexchangerates
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -61,7 +61,7 @@ dependencies:
61
61
  version: '0.2'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 0.2.0
64
+ version: 0.2.1
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -71,27 +71,27 @@ dependencies:
71
71
  version: '0.2'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 0.2.0
74
+ version: 0.2.1
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: cryptocoin_fanboi
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0.3'
81
+ version: '0.4'
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
- version: 0.3.4
84
+ version: 0.4.1
85
85
  type: :runtime
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '0.3'
91
+ version: '0.4'
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: 0.3.4
94
+ version: 0.4.1
95
95
  description:
96
96
  email: james@jamesrobertson.eu
97
97
  executables: []
@@ -122,5 +122,5 @@ rubyforge_project:
122
122
  rubygems_version: 2.6.13
123
123
  signing_key:
124
124
  specification_version: 4
125
- summary: The mycoins gem is intended to show the current value of your cryptocoins.
125
+ summary: The mycoins gem calculates the current value of your crypto-currency portfolio.
126
126
  test_files: []
metadata.gz.sig CHANGED
Binary file