cryptum 0.0.450 → 0.0.452

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
  SHA256:
3
- metadata.gz: '0927792ea2ac9e77095747e146ec3c0bfab5d8387ebee48f4032af5dfa2ed7f1'
4
- data.tar.gz: 49985b1166bcd865fbee9b73d028c9bfc47be457b544a3426ca74a353b937dea
3
+ metadata.gz: 6d6c8c355fd03538785ac48aec8903bcab7cbf8e5836c58b04a54d7097226f1f
4
+ data.tar.gz: 7ac941cbc7664c6f7a93ab0b9435baa2b18092a06e0aafb1a04cac5734ee2933
5
5
  SHA512:
6
- metadata.gz: 897dbfe423703b75244b22a72ce28e8222efc95884778ad02044e93322da09a57758cd90c49e615dd06985a7c9cd2d432890405a139128a8506cd5c996ef1a57
7
- data.tar.gz: 4fff271c7398bc2fe5ca987d7343143aae47ecc34f48f20b5faf1d0d397bbc4a6949d7c260a6ad34bf2afbde624878257418d03782906f5247d66f41b86f58af
6
+ metadata.gz: 856f94579e0da11c2413c956a86bbc7e8f5edc68d362fab33fcbfefb07b031cd26904dbca57ea915714f42fcad65e54ac6fdc452749ec7ce35037817454752b6
7
+ data.tar.gz: '009270dbf188f8fa91b689154d9e09d6036aee635cf3ed67295c041c290c4571d475c54b73958746b19cf3df6d7ae48aca4d44e47d088a304d9a27dc3337d953'
data/.rubocop.yml CHANGED
@@ -6,7 +6,7 @@ Layout/LineLength:
6
6
  Lint/UselessRescue:
7
7
  Enabled: false
8
8
  Metrics/AbcSize:
9
- Max: 447.2
9
+ Max: 458.7
10
10
  Metrics/BlockLength:
11
11
  Max: 138
12
12
  Metrics/BlockNesting:
@@ -14,13 +14,13 @@ Metrics/BlockNesting:
14
14
  Metrics/ClassLength:
15
15
  Max: 134
16
16
  Metrics/CyclomaticComplexity:
17
- Max: 89
17
+ Max: 91
18
18
  Metrics/MethodLength:
19
- Max: 418
19
+ Max: 421
20
20
  Metrics/ModuleLength:
21
- Max: 428
21
+ Max: 431
22
22
  Metrics/PerceivedComplexity:
23
- Max: 87
23
+ Max: 89
24
24
  Style/HashSyntax:
25
25
  EnforcedShorthandSyntax: never
26
26
 
@@ -295,6 +295,14 @@ module Cryptum
295
295
  end
296
296
  end
297
297
 
298
+ # Sync up sell order completion dates if possible
299
+ out_of_sync_green_orders = oh_meta_sold_arr.reject do |ohm|
300
+ ohm[:done_at] == ohm[:sell_details][:done_at]
301
+ end
302
+ out_of_sync_green_orders.each do |ohm|
303
+ ohm[:done_at] = ohm[:sell_details][:done_at]
304
+ end
305
+
298
306
  # OK, now let's tally up everything...
299
307
  twenty_four_hrs_ago = Time.now - 86_400
300
308
 
@@ -307,20 +315,33 @@ module Cryptum
307
315
  end
308
316
  order_hist_meta_sold_twenty_four = ohm_sold_twenty_four_arr.length
309
317
 
310
- # Snag all expired orders
311
- oh_meta_expired_arr = order_history_meta.select do |ohm|
312
- ohm[:color].to_sym == :white && ohm.key?(:done_at)
318
+ # Calculate Average Round Trip for Sold Orders
319
+ # (i.e. Time between buy && sell dates)
320
+ avg_round_trip_days_out = 0.0
321
+ unless oh_meta_sold_arr.empty?
322
+ round_trip_aggregate = 0
323
+ oh_meta_sold_arr.each do |ohm|
324
+ buy_date = Time.parse(ohm[:buy_details][:done_at])
325
+ sell_date = Time.parse(ohm[:sell_details][:done_at])
326
+ round_trip_aggregate += sell_date - buy_date
327
+ end
328
+ avg_round_trip_days = (round_trip_aggregate / oh_meta_sold_arr.length) / 86_400.0
329
+ avg_round_trip_days_out = format('%.2f', avg_round_trip_days)
313
330
  end
314
- order_hist_meta_expired = oh_meta_expired_arr.length
331
+ # Snag all expired orders
332
+ # oh_meta_expired_arr = order_history_meta.select do |ohm|
333
+ # ohm[:color].to_sym == :white && ohm.key?(:done_at)
334
+ # end
335
+ # order_hist_meta_expired = oh_meta_expired_arr.length
315
336
 
316
337
  # Snag all expired orders within past 24 hrs
317
- ohm_expire_twenty_four_arr = []
318
- unless oh_meta_expired_arr.empty?
319
- ohm_expire_twenty_four_arr = oh_meta_expired_arr.select do |o|
320
- Time.parse(o[:done_at]) >= twenty_four_hrs_ago
321
- end
322
- end
323
- order_hist_meta_24h_expired = ohm_expire_twenty_four_arr.length
338
+ # ohm_expire_twenty_four_arr = []
339
+ # unless oh_meta_expired_arr.empty?
340
+ # ohm_expire_twenty_four_arr = oh_meta_expired_arr.select do |o|
341
+ # Time.parse(o[:done_at]) >= twenty_four_hrs_ago
342
+ # end
343
+ # end
344
+ # order_hist_meta_24h_expired = ohm_expire_twenty_four_arr.length
324
345
 
325
346
  # Calculate gains within past 24 hrs
326
347
  # && Calculate gains YTD
@@ -543,7 +564,7 @@ module Cryptum
543
564
  header_str = "SELLING: #{total_to_sell} w tProf: $#{total_selling_profit_out} | "
544
565
  header_str += "SOLD 24h: #{order_hist_meta_sold_twenty_four} YTD: #{order_hist_meta_sold} | "
545
566
  header_str += "GAINS 24h: $#{gains_24h_out} YTD: $#{gains_out} | "
546
- header_str += "EXPIRED 24h: #{order_hist_meta_24h_expired} Tot: #{order_hist_meta_expired}"
567
+ header_str += "AVG RND TRIP DAYS: #{avg_round_trip_days_out}"
547
568
  order_execute_win.setpos(
548
569
  out_line_no,
549
570
  Cryptum::UI.col_center(str: header_str)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.450'
4
+ VERSION = '0.0.452'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.450
4
+ version: 0.0.452
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.