cryptum 0.0.260 → 0.0.262

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d516fc49952990a6873f6e2533dbc7853cc5a7b759bd36ecc9146635efd19e5
4
- data.tar.gz: af1d4ff1fdefc57021edb8894a54c932d1e28618b7fd7001eea8b73ef22fd7ea
3
+ metadata.gz: 1613515179a2bffe718ae5afe3828daf161bc4502dbe8ff3df2f60bb42659234
4
+ data.tar.gz: 590ed73249828eb8b7f71ef647964d31a985d9653253cf66756784b909749902
5
5
  SHA512:
6
- metadata.gz: 87b2644569e9931c657c9788fd4f8de94ad3ad4f79b0101db8c8a457fb243f3762db38cf5af780ad47e853c866bf675cef479569cc9782a0f9706bf1d73b7500
7
- data.tar.gz: db4817a4d481ec036126f5e7d69f4bc5d186c0eb0d9def78e2a2addcf08e86ab2907b3199ffd945ee564ed6e9a47f098d5a6ada396cc4db69e5e4f1a2cfdd7f3
6
+ metadata.gz: fb88630123183ba7c3ba6daccf547dd22f77d1c15c95767bc92e3672f5097352c9677a2d3faa3047fd9773d531ef0bd276758488fb8efc24cc529f8bd5a90d94
7
+ data.tar.gz: a6a5f988349fc5aafe94d1a602594c6f586a3430f8cdfe469b253da4cc9021174c5c63a075d3c65343a4f4aaad36226b5c60b3fe23521f24b6f92cdeead7ceaf
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-12-02 18:49:14 UTC using RuboCop version 1.39.0.
3
+ # on 2022-12-02 19:50:43 UTC using RuboCop version 1.39.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -102,7 +102,7 @@ Layout/TrailingWhitespace:
102
102
  - 'lib/cryptum/ui/order_plan.rb'
103
103
  - 'lib/cryptum/ui/order_timer.rb'
104
104
 
105
- # Offense count: 54
105
+ # Offense count: 56
106
106
  Lint/UselessAssignment:
107
107
  Exclude:
108
108
  - 'bin/cryptum-forecast'
@@ -123,7 +123,7 @@ Lint/UselessAssignment:
123
123
  # Offense count: 39
124
124
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
125
125
  Metrics/AbcSize:
126
- Max: 401
126
+ Max: 400
127
127
 
128
128
  # Offense count: 7
129
129
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
@@ -139,12 +139,12 @@ Metrics/BlockNesting:
139
139
  # Offense count: 16
140
140
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
141
141
  Metrics/CyclomaticComplexity:
142
- Max: 72
142
+ Max: 73
143
143
 
144
144
  # Offense count: 56
145
145
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
146
146
  Metrics/MethodLength:
147
- Max: 391
147
+ Max: 387
148
148
 
149
149
  # Offense count: 15
150
150
  # Configuration parameters: CountComments, CountAsOne.
@@ -154,7 +154,7 @@ Metrics/ModuleLength:
154
154
  # Offense count: 17
155
155
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
156
156
  Metrics/PerceivedComplexity:
157
- Max: 75
157
+ Max: 76
158
158
 
159
159
  # Offense count: 1
160
160
  # This cop supports safe autocorrection (--autocorrect).
@@ -221,14 +221,12 @@ Style/StringChars:
221
221
  Exclude:
222
222
  - 'lib/cryptum.rb'
223
223
 
224
- # Offense count: 3
224
+ # Offense count: 1
225
225
  # This cop supports safe autocorrection (--autocorrect).
226
226
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
227
227
  # SupportedStyles: single_quotes, double_quotes
228
228
  Style/StringLiterals:
229
229
  Exclude:
230
- - 'lib/cryptum/ui/order_execution.rb'
231
- - 'lib/cryptum/ui/order_timer.rb'
232
230
  - 'lib/cryptum/ui/portfolio.rb'
233
231
 
234
232
  # Offense count: 2
@@ -247,7 +245,7 @@ Style/TrailingCommaInArrayLiteral:
247
245
  Exclude:
248
246
  - 'lib/cryptum/matrix.rb'
249
247
 
250
- # Offense count: 14
248
+ # Offense count: 15
251
249
  # This cop supports safe autocorrection (--autocorrect).
252
250
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
253
251
  # URISchemes: http, https
@@ -425,60 +425,62 @@ module Cryptum
425
425
  event_history.order_execute_index_offset = first_row
426
426
  end
427
427
 
428
- order_history_meta.reverse[first_row..last_row].each do |meta|
429
- out_line_no += 1
430
- current_line = out_line_no - 2
431
-
432
- style = :normal
433
- style = :highlight if event_history.order_execute_row_to_select == current_line
434
- risk_alloc_out = Cryptum.beautify_large_number(
435
- value: meta[:risk_alloc]
436
- )
437
- invest_out = Cryptum.beautify_large_number(
438
- value: meta[:invest]
439
- )
440
- price_out = Cryptum.beautify_large_number(
441
- value: meta[:price]
442
- )
443
- size_out = Cryptum.beautify_large_number(
444
- value: meta[:size]
445
- )
446
- target_price_out = Cryptum.beautify_large_number(
447
- value: meta[:target_price]
448
- )
449
- profit_out = Cryptum.beautify_large_number(
450
- value: meta[:profit]
451
- )
452
- plan_no = "#{meta[:plan_no]}|"
428
+ if order_history_meta.any?
429
+ order_history_meta.reverse[first_row..last_row].each do |meta|
430
+ out_line_no += 1
431
+ current_line = out_line_no - 2
432
+
433
+ style = :normal
434
+ style = :highlight if event_history.order_execute_row_to_select == current_line
435
+ risk_alloc_out = Cryptum.beautify_large_number(
436
+ value: meta[:risk_alloc]
437
+ )
438
+ invest_out = Cryptum.beautify_large_number(
439
+ value: meta[:invest]
440
+ )
441
+ price_out = Cryptum.beautify_large_number(
442
+ value: meta[:price]
443
+ )
444
+ size_out = Cryptum.beautify_large_number(
445
+ value: meta[:size]
446
+ )
447
+ target_price_out = Cryptum.beautify_large_number(
448
+ value: meta[:target_price]
449
+ )
450
+ profit_out = Cryptum.beautify_large_number(
451
+ value: meta[:profit]
452
+ )
453
+ plan_no = "#{meta[:plan_no]}|"
453
454
 
454
- buy_created_at_hash_arr = order_history.select do |oh|
455
- oh[:id] == meta[:buy_order_id]
456
- end
455
+ buy_created_at_hash_arr = order_history.select do |oh|
456
+ oh[:id] == meta[:buy_order_id]
457
+ end
457
458
 
458
- buy_created_at = '__-__ __:__:__'
459
- unless buy_created_at_hash_arr.empty?
460
- buy_created_at = Time.parse(
461
- buy_created_at_hash_arr.first[:created_at]
462
- ).strftime('%m-%d %H:%M:%S')
463
- end
459
+ buy_created_at = '____-__-__ __:__:__'
460
+ unless buy_created_at_hash_arr.empty?
461
+ buy_created_at = Time.parse(
462
+ buy_created_at_hash_arr.first[:created_at]
463
+ ).strftime('%Y-%m-%d %H:%M:%S')
464
+ end
464
465
 
465
- invest = "$#{invest_out} @ "
466
- tick = "$#{price_out} = "
467
- size = "*#{size_out} + "
468
- tpm_out = "#{meta[:tpm]}% = "
469
- targ_tick = "$#{target_price_out}"
470
- profit = "|Profit: $#{meta[:profit]}"
471
-
472
- order_exec_ln = "#{plan_no}#{buy_created_at}|#{invest}#{tick}#{size}#{tpm_out}#{targ_tick}#{profit}"
473
-
474
- order_execute_win.setpos(out_line_no, Cryptum::UI.col_first)
475
- order_execute_win.clrtoeol
476
- Cryptum::UI.colorize(
477
- ui_win: order_execute_win,
478
- color: meta[:color],
479
- style: style,
480
- string: order_exec_ln.ljust(col_just1, '.')
481
- )
466
+ invest = "$#{invest_out} @ "
467
+ tick = "$#{price_out} = "
468
+ size = "*#{size_out} + "
469
+ tpm_out = "#{meta[:tpm]}% = "
470
+ targ_tick = "$#{target_price_out}"
471
+ profit = "|Profit: $#{meta[:profit]}"
472
+
473
+ order_exec_ln = "#{buy_created_at}|#{invest}#{tick}#{size}#{tpm_out}#{targ_tick}#{profit}"
474
+
475
+ order_execute_win.setpos(out_line_no, Cryptum::UI.col_first)
476
+ order_execute_win.clrtoeol
477
+ Cryptum::UI.colorize(
478
+ ui_win: order_execute_win,
479
+ color: meta[:color],
480
+ style: style,
481
+ string: order_exec_ln.ljust(col_just1, '.')
482
+ )
483
+ end
482
484
  end
483
485
 
484
486
  # ROW 10
@@ -492,7 +494,7 @@ module Cryptum
492
494
  string: ''.ljust(col_just1, ' ')
493
495
  )
494
496
 
495
- header_str = "SUMMARY: #{total_to_sell} | #{order_hist_meta_expired} Expired | #{order_hist_meta_sold} Sold | $#{gains_24h_out} Gained"
497
+ header_str = "24 HR SUMMARY | Open Sell Orders: #{total_to_sell} | Sold: #{order_hist_meta_sold} | Gains: $#{gains_24h_out} | Expired: #{order_hist_meta_expired}"
496
498
  order_execute_win.setpos(
497
499
  out_line_no,
498
500
  Cryptum::UI.col_center(str: header_str)
@@ -80,7 +80,8 @@ module Cryptum
80
80
 
81
81
  event_history.red_pill = true if crypto_invested_percent.to_f > autotrade_percent
82
82
 
83
- if crypto_invested_percent.to_f <= autotrade_percent && (
83
+ if crypto_invested_percent.to_f <= autotrade_percent &&
84
+ autotrade_percent.positive? && (
84
85
  order_plan.empty? || (
85
86
  indicator_status.action_signal == :buy &&
86
87
  indicator_status.last_action_signal == :sell
@@ -389,7 +390,7 @@ module Cryptum
389
390
  string: ''.ljust(col_just1, ' ')
390
391
  )
391
392
 
392
- header_str = "SUMMARY: $#{order_plan_volume_out} w #{max_order_plan_slices} Slices | $#{order_plan_profit_sum_out} 2 Gain | #{order_plan_exec_percent}% Done"
393
+ header_str = "CYCLE SUMMARY | Slices: #{max_order_plan_slices} | Risk Allocated: $#{order_plan_volume_out} | Profit: $#{order_plan_profit_sum_out} | #{order_plan_exec_percent}% Done"
393
394
  order_plan_win.setpos(
394
395
  out_line_no,
395
396
  Cryptum::UI.col_center(str: header_str)
@@ -36,7 +36,7 @@ module Cryptum
36
36
  open_24h = event[:open_24h].to_f
37
37
  order_book[:open_24h] = open_24h
38
38
 
39
- open_24h_out = "#{Cryptum.open_symbol} #{fiat_symbol}#{format("%0.#{fiat_smallest_decimal}f", open_24h)}"
39
+ open_24h_out = "#{Cryptum.open_symbol} #{fiat_symbol}#{Cryptum.beautify_large_number(value: format("%0.#{fiat_smallest_decimal}f", open_24h))}"
40
40
 
41
41
  beautify_ticker = Cryptum.beautify_large_number(
42
42
  value: format("%0.#{fiat_smallest_decimal}f", event[:price].to_f)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.260'
4
+ VERSION = '0.0.262'
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.260
4
+ version: 0.0.262
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.