cryptum 0.0.259 → 0.0.261

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: ab14ca560e814d115f113801ad78732ba8d10acce087f6eaadc143233424ffa4
4
- data.tar.gz: 47bc5482fba211e04bf7ef299fafd323cf5388908d5786779cda36885748d198
3
+ metadata.gz: 4d760ea86d8e98005d157ecee37d0b52fbd89bc44bc5c093bac8201020dfee8c
4
+ data.tar.gz: e6e52346266ac38bf4f3e71535a17a6891388f27e06884985f35c7f09a957d6f
5
5
  SHA512:
6
- metadata.gz: cb7dd04b5337366f545a283d6b1dc184c1680279aa88f2d423ad4544374f018c2ec5cef61a15f1770bb39f69d0092898d8af198329b80c6b005321ae3c249df0
7
- data.tar.gz: 949378bda3b6959556f3f888795780e46fe5e1e857814254273f4658ad5a4b81a81c0b86aa55b8e325e026a5ed51e67082cdc5740d2df12e23c25afeb63d0ff6
6
+ metadata.gz: bffdfad77d1716fd242f4441a271066851c397fe44f3e3ec828b22bf8688236c98bd5b22d27e18da526c4c6bd445731351913eea9cb38b982216b459571a9fc5
7
+ data.tar.gz: dd2c16cbdb3ebdf0349cde5e5e9f4a08ad2f436bceed8994b44695ebbadec9552848e0a0ddb85da5dd408f9050b5ea5dbc598edeb7177cb705e034b952107e73
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-01 23:59:06 UTC using RuboCop version 1.39.0.
3
+ # on 2022-12-02 18:49:14 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
@@ -35,12 +35,11 @@ Layout/EmptyLineAfterGuardClause:
35
35
  - 'lib/cryptum/order_book/market_trend.rb'
36
36
  - 'lib/cryptum/ui/order_execution.rb'
37
37
 
38
- # Offense count: 2
38
+ # Offense count: 1
39
39
  # This cop supports safe autocorrection (--autocorrect).
40
40
  Layout/EmptyLines:
41
41
  Exclude:
42
42
  - 'lib/cryptum/api.rb'
43
- - 'lib/cryptum/ui/order_execution.rb'
44
43
 
45
44
  # Offense count: 1
46
45
  # This cop supports safe autocorrection (--autocorrect).
@@ -91,7 +90,7 @@ Layout/SpaceAroundOperators:
91
90
  Exclude:
92
91
  - 'lib/cryptum/ui/order_plan.rb'
93
92
 
94
- # Offense count: 11
93
+ # Offense count: 13
95
94
  # This cop supports safe autocorrection (--autocorrect).
96
95
  # Configuration parameters: AllowInHeredoc.
97
96
  Layout/TrailingWhitespace:
@@ -103,7 +102,7 @@ Layout/TrailingWhitespace:
103
102
  - 'lib/cryptum/ui/order_plan.rb'
104
103
  - 'lib/cryptum/ui/order_timer.rb'
105
104
 
106
- # Offense count: 52
105
+ # Offense count: 54
107
106
  Lint/UselessAssignment:
108
107
  Exclude:
109
108
  - 'bin/cryptum-forecast'
@@ -124,13 +123,13 @@ Lint/UselessAssignment:
124
123
  # Offense count: 39
125
124
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
126
125
  Metrics/AbcSize:
127
- Max: 387
126
+ Max: 401
128
127
 
129
128
  # Offense count: 7
130
129
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
131
130
  # AllowedMethods: refine
132
131
  Metrics/BlockLength:
133
- Max: 141
132
+ Max: 139
134
133
 
135
134
  # Offense count: 4
136
135
  # Configuration parameters: CountBlocks.
@@ -145,7 +144,7 @@ Metrics/CyclomaticComplexity:
145
144
  # Offense count: 56
146
145
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
147
146
  Metrics/MethodLength:
148
- Max: 362
147
+ Max: 391
149
148
 
150
149
  # Offense count: 15
151
150
  # Configuration parameters: CountComments, CountAsOne.
@@ -222,12 +221,13 @@ Style/StringChars:
222
221
  Exclude:
223
222
  - 'lib/cryptum.rb'
224
223
 
225
- # Offense count: 2
224
+ # Offense count: 3
226
225
  # This cop supports safe autocorrection (--autocorrect).
227
226
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
228
227
  # SupportedStyles: single_quotes, double_quotes
229
228
  Style/StringLiterals:
230
229
  Exclude:
230
+ - 'lib/cryptum/ui/order_execution.rb'
231
231
  - 'lib/cryptum/ui/order_timer.rb'
232
232
  - 'lib/cryptum/ui/portfolio.rb'
233
233
 
@@ -50,7 +50,7 @@ module Cryptum
50
50
  self.red_pill = false
51
51
  self.order_plan_win_active = true
52
52
  self.order_plan_index_offset = 0
53
- self.order_plan_max_rows_to_display = 7
53
+ self.order_plan_max_rows_to_display = 6
54
54
  self.order_plan_row_to_select = order_plan_index_offset
55
55
  self.order_execute_win_active = false
56
56
  self.order_execute_index_offset = 0
@@ -33,12 +33,16 @@ module Cryptum
33
33
 
34
34
  # order_difference = 0
35
35
  if buy_total > sell_total
36
- order_difference = buy_total - sell_total
36
+ order_difference = Cryptum.beautify_large_number(
37
+ value: buy_total - sell_total
38
+ ).to_i
37
39
  indicator_hash[:color] = :green
38
40
  indicator_hash[:ui] = "BUYS UP BY #{order_difference}"
39
41
  indicator_hash[:status] = "B#{Cryptum.up_arrow}"
40
42
  elsif buy_total < sell_total
41
- order_difference = sell_total - buy_total
43
+ order_difference = Cryptum.beautify_large_number(
44
+ value: sell_total - buy_total
45
+ ).to_i
42
46
  indicator_hash[:color] = :red
43
47
  indicator_hash[:ui] = "SELLS UP BY #{order_difference}"
44
48
  indicator_hash[:status] = "S#{Cryptum.up_arrow}"
@@ -367,6 +367,7 @@ module Cryptum
367
367
  # UI
368
368
  col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
369
369
  col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
370
+ col_just4 = Curses.cols - Cryptum::UI.col_fourth
370
371
 
371
372
  Cryptum::UI.detect_key_press_in_ui(
372
373
  key_press_event: key_press_event,
@@ -376,8 +377,14 @@ module Cryptum
376
377
  # ROW 1
377
378
  out_line_no = 0
378
379
  line_color = :white
380
+ header_color = :white
381
+ header_style = :bold
379
382
  style = :bold
380
- line_color = :red if event_history.order_execute_win_active
383
+ if event_history.order_execute_win_active
384
+ line_color = :blue
385
+ header_color = :yellow
386
+ header_style = :reverse
387
+ end
381
388
 
382
389
  Cryptum::UI.line(
383
390
  ui_win: order_execute_win,
@@ -391,32 +398,25 @@ module Cryptum
391
398
  order_execute_win.clrtoeol
392
399
  Cryptum::UI.colorize(
393
400
  ui_win: order_execute_win,
394
- color: :white,
395
- style: style,
396
- string: 'Open Sell Orders | 24 Hr Stats:'
401
+ color: header_color,
402
+ style: header_style,
403
+ string: ''.ljust(col_just1, ' ')
397
404
  )
398
405
 
399
- order_execute_win.setpos(out_line_no, Cryptum::UI.col_third)
400
- Cryptum::UI.colorize(
401
- ui_win: order_execute_win,
402
- color: :white,
403
- style: style,
404
- string: "#{total_to_sell} | #{order_hist_meta_expired} Expired | #{order_hist_meta_sold} Sold | $#{gains_24h_out} Gained".rjust(
405
- col_just3,
406
- '.'
407
- )
406
+ header_str = '- ORDER HISTORY -'
407
+ order_execute_win.setpos(
408
+ out_line_no,
409
+ Cryptum::UI.col_center(str: header_str)
408
410
  )
409
411
 
410
- # ROW 3
411
- out_line_no += 1
412
- Cryptum::UI.line(
412
+ Cryptum::UI.colorize(
413
413
  ui_win: order_execute_win,
414
- out_line_no: out_line_no,
415
- color: line_color
414
+ color: header_color,
415
+ style: header_style,
416
+ string: header_str
416
417
  )
417
418
 
418
-
419
- # ROWS 4-10
419
+ # ROWS 3-10
420
420
  first_row = event_history.order_execute_index_offset
421
421
  last_row = first_row + event_history.order_execute_max_rows_to_display
422
422
  if last_row >= order_history_meta.length
@@ -427,7 +427,7 @@ module Cryptum
427
427
 
428
428
  order_history_meta.reverse[first_row..last_row].each do |meta|
429
429
  out_line_no += 1
430
- current_line = out_line_no - 3
430
+ current_line = out_line_no - 2
431
431
 
432
432
  style = :normal
433
433
  style = :highlight if event_history.order_execute_row_to_select == current_line
@@ -455,11 +455,11 @@ module Cryptum
455
455
  oh[:id] == meta[:buy_order_id]
456
456
  end
457
457
 
458
- buy_created_at = '__-__ __:__:__'
458
+ buy_created_at = '____-__-__ __:__:__'
459
459
  unless buy_created_at_hash_arr.empty?
460
460
  buy_created_at = Time.parse(
461
461
  buy_created_at_hash_arr.first[:created_at]
462
- ).strftime('%m-%d %H:%M:%S')
462
+ ).strftime('%Y-%m-%d %H:%M:%S')
463
463
  end
464
464
 
465
465
  invest = "$#{invest_out} @ "
@@ -469,7 +469,7 @@ module Cryptum
469
469
  targ_tick = "$#{target_price_out}"
470
470
  profit = "|Profit: $#{meta[:profit]}"
471
471
 
472
- order_exec_ln = "#{plan_no}#{buy_created_at}|#{invest}#{tick}#{size}#{tpm_out}#{targ_tick}#{profit}"
472
+ order_exec_ln = "#{buy_created_at}|#{invest}#{tick}#{size}#{tpm_out}#{targ_tick}#{profit}"
473
473
 
474
474
  order_execute_win.setpos(out_line_no, Cryptum::UI.col_first)
475
475
  order_execute_win.clrtoeol
@@ -481,6 +481,32 @@ module Cryptum
481
481
  )
482
482
  end
483
483
 
484
+ # ROW 10
485
+ out_line_no += 1
486
+ order_execute_win.setpos(out_line_no, Cryptum::UI.col_first)
487
+ order_execute_win.clrtoeol
488
+ Cryptum::UI.colorize(
489
+ ui_win: order_execute_win,
490
+ color: header_color,
491
+ style: header_style,
492
+ string: ''.ljust(col_just1, ' ')
493
+ )
494
+
495
+ 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
+ order_execute_win.setpos(
497
+ out_line_no,
498
+ Cryptum::UI.col_center(str: header_str)
499
+ )
500
+
501
+ Cryptum::UI.colorize(
502
+ ui_win: order_execute_win,
503
+ color: header_color,
504
+ style: header_style,
505
+ string: header_str
506
+ )
507
+
508
+ # ROW 11
509
+ out_line_no += 1
484
510
  Cryptum::UI.line(
485
511
  ui_win: order_execute_win,
486
512
  out_line_no: out_line_no,
@@ -200,8 +200,14 @@ module Cryptum
200
200
  # ROW 1
201
201
  out_line_no = 0
202
202
  line_color = :white
203
+ header_color = :white
204
+ header_style = :bold
203
205
  style = :bold
204
- line_color = :red if event_history.order_plan_win_active
206
+ if event_history.order_plan_win_active
207
+ line_color = :blue
208
+ header_color = :yellow
209
+ header_style = :reverse
210
+ end
205
211
 
206
212
  Cryptum::UI.line(
207
213
  ui_win: order_plan_win,
@@ -215,31 +221,25 @@ module Cryptum
215
221
  order_plan_win.clrtoeol
216
222
  Cryptum::UI.colorize(
217
223
  ui_win: order_plan_win,
218
- color: :white,
219
- style: style,
220
- string: "Order Plan ##{order_plan_prefix} Summary:"
224
+ color: header_color,
225
+ style: header_style,
226
+ string: ''.ljust(col_just1, ' ')
227
+ )
228
+
229
+ header_str = "- ORDER PLAN: Cycle ##{order_plan_prefix} -"
230
+ order_plan_win.setpos(
231
+ out_line_no,
232
+ Cryptum::UI.col_center(str: header_str)
221
233
  )
222
234
 
223
- order_plan_win.setpos(out_line_no, Cryptum::UI.col_third)
224
235
  Cryptum::UI.colorize(
225
236
  ui_win: order_plan_win,
226
- color: :white,
227
- style: style,
228
- string: "$#{order_plan_volume_out} w #{max_order_plan_slices} Slices | $#{order_plan_profit_sum_out} 2 Gain | #{order_plan_exec_percent}% Done".rjust(
229
- col_just3,
230
- '.'
231
- )
232
- )
233
-
234
- # ROW 3
235
- out_line_no += 1
236
- Cryptum::UI.line(
237
- ui_win: order_plan_win,
238
- out_line_no: out_line_no,
239
- color: line_color
237
+ color: header_color,
238
+ style: header_style,
239
+ string: header_str
240
240
  )
241
241
 
242
- # ROWS 4-10
242
+ # ROWS 3-10
243
243
  if event_history.red_pill
244
244
  out_line_no += 1
245
245
  order_plan_win.setpos(out_line_no, Cryptum::UI.col_first)
@@ -327,7 +327,7 @@ module Cryptum
327
327
 
328
328
  order_plan[first_row..last_row].each do |order|
329
329
  out_line_no += 1
330
- current_line = out_line_no - 3
330
+ current_line = out_line_no - 2
331
331
 
332
332
  style = :normal
333
333
  style = :highlight if event_history.order_plan_row_to_select == current_line
@@ -378,6 +378,32 @@ module Cryptum
378
378
  end
379
379
  end
380
380
 
381
+ # ROW 10
382
+ out_line_no += 1
383
+ order_plan_win.setpos(out_line_no, Cryptum::UI.col_first)
384
+ order_plan_win.clrtoeol
385
+ Cryptum::UI.colorize(
386
+ ui_win: order_plan_win,
387
+ color: header_color,
388
+ style: header_style,
389
+ string: ''.ljust(col_just1, ' ')
390
+ )
391
+
392
+ header_str = "CYCLE SUMMARY | Risk Allocated: $#{order_plan_volume_out} | Slices: #{max_order_plan_slices} | Profit: $#{order_plan_profit_sum_out} | #{order_plan_exec_percent}% Done"
393
+ order_plan_win.setpos(
394
+ out_line_no,
395
+ Cryptum::UI.col_center(str: header_str)
396
+ )
397
+
398
+ Cryptum::UI.colorize(
399
+ ui_win: order_plan_win,
400
+ color: header_color,
401
+ style: header_style,
402
+ string: header_str
403
+ )
404
+
405
+ # ROW 11
406
+ out_line_no += 1
381
407
  Cryptum::UI.line(
382
408
  ui_win: order_plan_win,
383
409
  out_line_no: out_line_no,
@@ -51,9 +51,9 @@ module Cryptum
51
51
  case color
52
52
  when :green
53
53
  # TODO: add condition to check if open sell orders exist.
54
- # If so intent should be something like, "- SEE LIMIT SELL ORDERS -"
54
+ # If so intent should be something like, "- SEE ORDER HISTORY -"
55
55
  # Otherwise, intent should be something like, "- WAIT FOR MARKET TREND SHIFT -"
56
- intent = "- SEE LIMIT SELL ORDERS -"
56
+ intent = "- SEE ORDER HISTORY #{Cryptum.down_arrow} -"
57
57
  else
58
58
  speed = 'FAST'
59
59
  speed = 'SLOW' if event_history.bullish_trend
@@ -69,6 +69,7 @@ module Cryptum
69
69
  col_just4 = (Curses.cols - Cryptum::UI.col_fourth) - 1
70
70
 
71
71
  # ROW 1
72
+ # COLUMN 1
72
73
  out_line_no = 0
73
74
  order_timer_win.setpos(out_line_no, Cryptum::UI.col_first)
74
75
  order_timer_win.clrtoeol
@@ -79,6 +80,7 @@ module Cryptum
79
80
  string: "Market Trend Reset: #{trend_countdown}"
80
81
  )
81
82
 
83
+ # COLUMN 2
82
84
  order_timer_win.setpos(
83
85
  out_line_no,
84
86
  Cryptum::UI.col_center(str: intent)
@@ -90,6 +92,7 @@ module Cryptum
90
92
  string: intent
91
93
  )
92
94
 
95
+ # COLUMN 3
93
96
  order_timer_win.setpos(out_line_no, Cryptum::UI.col_fourth)
94
97
  Cryptum::UI.colorize(
95
98
  ui_win: order_timer_win,
@@ -42,7 +42,7 @@ module Cryptum
42
42
  )
43
43
 
44
44
  self.order_plan_section = Cryptum::UI.window(
45
- height: 12,
45
+ height: 11,
46
46
  width: 0,
47
47
  top: 13,
48
48
  left: 0
@@ -79,7 +79,7 @@ module Cryptum
79
79
  self.command_section = Cryptum::UI.window(
80
80
  height: 3,
81
81
  width: 0,
82
- top: 39,
82
+ top: 40,
83
83
  left: 0
84
84
  )
85
85
  end
@@ -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.259'
4
+ VERSION = '0.0.261'
5
5
  end
@@ -134,18 +134,15 @@ module Cryptum
134
134
  terminal_win.key_press_event.key_esc = false
135
135
  terminal_win.key_press_event.key_down_arrow = false
136
136
  if event_history.order_plan_win_active
137
- order_plan_max_row_index = event_history.order_plan_max_rows_to_display - 1
138
137
  event_history.order_plan_row_to_select += 1
139
- event_history.order_plan_index_offset += 1 if event_history.order_plan_row_to_select > order_plan_max_row_index
140
- event_history.order_plan_row_to_select = order_plan_max_row_index if event_history.order_plan_row_to_select > order_plan_max_row_index
138
+ event_history.order_plan_index_offset += 1 if event_history.order_plan_row_to_select > event_history.order_plan_max_rows_to_display
139
+ event_history.order_plan_row_to_select = event_history.order_plan_max_rows_to_display if event_history.order_plan_row_to_select > event_history.order_plan_max_rows_to_display
141
140
  end
142
141
 
143
142
  if event_history.order_execute_win_active
144
- order_execute_max_row_index = event_history.order_execute_max_rows_to_display - 1
145
143
  event_history.order_execute_row_to_select += 1
146
- event_history.order_execute_index_offset += 1 if event_history.order_execute_row_to_select > order_execute_max_row_index
147
- event_history.order_execute_row_to_select = order_execute_max_row_index if event_history.order_execute_row_to_select > order_execute_max_row_index
148
-
144
+ event_history.order_execute_index_offset += 1 if event_history.order_execute_row_to_select > event_history.order_execute_max_rows_to_display
145
+ event_history.order_execute_row_to_select = event_history.order_execute_max_rows_to_display if event_history.order_execute_row_to_select > event_history.order_execute_max_rows_to_display
149
146
  end
150
147
  end
151
148
 
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.259
4
+ version: 0.0.261
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.