cryptum 0.0.255 → 0.0.256

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: 821d3666c9176e49b63ba26c032d24a901e1c5eab538726d8b675860156190fd
4
- data.tar.gz: 7a58108f07d42aefce9112c6349e76c802590ed9e21b829f3d96ae22700483de
3
+ metadata.gz: 2687c6be08b4b287a0f9ad8192708a0f862b526933614bcd440607fa667e6e06
4
+ data.tar.gz: 00c9a699c865e8f91cdecafcc896e19a1481100c01e492c3bf53e15a22df9ee2
5
5
  SHA512:
6
- metadata.gz: 97c6fc6168fd04c6f4c6d55994ab27908977c4c7969aff195a60fb01f3e7a43f510056a16ff49f3e08e5d1f0f701f7f0633e85eda55ee4f4333ddcdbea169996
7
- data.tar.gz: 98a384029779c042d4059ed5194ffd65ba9179bfe7e1cc8a1746efc30cc53ee06be84bce7190adb4a893dca6114e4a950b739217b6906b41035d563b64672862
6
+ metadata.gz: fd74b3c4bd968db4e24b1a3fae5802b86d356619909e0d32a45d9d246d38c81a1b91714b3691f3ff7a3d95e2d4fcd0b57bdb408bfb89030062e1c57379379b5c
7
+ data.tar.gz: c2ec14727da1cfccc54afacb7760feb0062d640da5d7cc7e24189dcbad5c03c0e9aeacc339a619e53a192e236f43d98ddee672abc26349a20a2a630a48ae4a4d
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 03:19:16 UTC using RuboCop version 1.39.0.
3
+ # on 2022-12-01 19:02:17 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
@@ -123,13 +123,13 @@ Lint/UselessAssignment:
123
123
  # Offense count: 39
124
124
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
125
125
  Metrics/AbcSize:
126
- Max: 384
126
+ Max: 388
127
127
 
128
128
  # Offense count: 7
129
129
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
130
130
  # AllowedMethods: refine
131
131
  Metrics/BlockLength:
132
- Max: 117
132
+ Max: 135
133
133
 
134
134
  # Offense count: 4
135
135
  # Configuration parameters: CountBlocks.
@@ -144,7 +144,7 @@ Metrics/CyclomaticComplexity:
144
144
  # Offense count: 56
145
145
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
146
146
  Metrics/MethodLength:
147
- Max: 361
147
+ Max: 362
148
148
 
149
149
  # Offense count: 15
150
150
  # Configuration parameters: CountComments, CountAsOne.
@@ -207,7 +207,7 @@ Style/RedundantReturn:
207
207
  Exclude:
208
208
  - 'lib/cryptum.rb'
209
209
 
210
- # Offense count: 2
210
+ # Offense count: 4
211
211
  # This cop supports safe autocorrection (--autocorrect).
212
212
  Style/RedundantSelf:
213
213
  Exclude:
@@ -244,7 +244,7 @@ Style/TrailingCommaInArrayLiteral:
244
244
  Exclude:
245
245
  - 'lib/cryptum/matrix.rb'
246
246
 
247
- # Offense count: 10
247
+ # Offense count: 16
248
248
  # This cop supports safe autocorrection (--autocorrect).
249
249
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
250
250
  # URISchemes: http, https
@@ -25,10 +25,14 @@ module Cryptum
25
25
  :time_between_orders_max,
26
26
  :time_between_orders_min,
27
27
  :time_between_orders_reset,
28
- :order_plan_win_highlighted,
29
- :order_plan_line,
30
- :order_execute_win_highlighted,
31
- :order_execute_line
28
+ :order_plan_win_active,
29
+ :order_plan_index_offset,
30
+ :order_plan_max_rows_to_display,
31
+ :order_plan_row_to_select,
32
+ :order_execute_win_active,
33
+ :order_execute_index_offset,
34
+ :order_execute_max_rows_to_display,
35
+ :order_execute_row_to_select
32
36
 
33
37
  def initialize(opts = {})
34
38
  # option_choice = opts[:option_choice]
@@ -46,10 +50,14 @@ module Cryptum
46
50
  self.reconnected = false
47
51
  self.red_pill = false
48
52
  self.reset_market_trend = false
49
- self.order_plan_win_highlighted = true
50
- self.order_plan_line = 0
51
- self.order_execute_win_highlighted = false
52
- self.order_execute_line = 0
53
+ self.order_plan_win_active = true
54
+ self.order_plan_index_offset = 0
55
+ self.order_plan_max_rows_to_display = 7
56
+ self.order_plan_row_to_select = self.order_plan_index_offset
57
+ self.order_execute_win_active = false
58
+ self.order_execute_index_offset = 0
59
+ self.order_execute_max_rows_to_display = 6
60
+ self.order_execute_row_to_select = self.order_execute_index_offset
53
61
 
54
62
  # 10 minutes
55
63
  self.time_between_orders = 600
@@ -11,10 +11,10 @@ module Cryptum
11
11
  :key_w,
12
12
  :key_x,
13
13
  :key_ansi,
14
- :key_down,
14
+ :key_down_arrow,
15
15
  :key_esc,
16
16
  :key_tab,
17
- :key_up
17
+ :key_up_arrow
18
18
 
19
19
  rescue Interrupt
20
20
  # Exit Gracefully if CTRL+C is Pressed During Session
@@ -377,7 +377,7 @@ module Cryptum
377
377
  out_line_no = 0
378
378
  line_color = :white
379
379
  style = :bold
380
- line_color = :red if event_history.order_execute_win_highlighted
380
+ line_color = :red if event_history.order_execute_win_active
381
381
 
382
382
  Cryptum::UI.line(
383
383
  ui_win: order_execute_win,
@@ -417,18 +417,20 @@ module Cryptum
417
417
 
418
418
 
419
419
  # ROWS 4-10
420
- first_row = event_history.order_execute_line
421
- last_row = first_row + 6
420
+ first_row = event_history.order_execute_index_offset
421
+ last_row = first_row + event_history.order_execute_max_rows_to_display
422
422
  if last_row >= order_history_meta.length
423
423
  last_row = order_history_meta.length - 1
424
- first_row = last_row - 6
425
- event_history.order_execute_line = first_row
424
+ first_row = last_row - event_history.order_execute_max_rows_to_display
425
+ event_history.order_execute_index_offset = first_row
426
426
  end
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
431
+
430
432
  style = :normal
431
- style = :highlight if event_history.order_execute_win_highlighted
433
+ style = :highlight if event_history.order_execute_row_to_select == current_line
432
434
  risk_alloc_out = Cryptum.beautify_large_number(
433
435
  value: meta[:risk_alloc]
434
436
  )
@@ -201,7 +201,7 @@ module Cryptum
201
201
  out_line_no = 0
202
202
  line_color = :white
203
203
  style = :bold
204
- line_color = :red if event_history.order_plan_win_highlighted
204
+ line_color = :red if event_history.order_plan_win_active
205
205
 
206
206
  Cryptum::UI.line(
207
207
  ui_win: order_plan_win,
@@ -317,18 +317,20 @@ module Cryptum
317
317
  plan_color = :cyan if color == :red
318
318
  plan_color = :green if color == :green
319
319
 
320
- first_row = event_history.order_plan_line
321
- last_row = first_row + 7
320
+ first_row = event_history.order_plan_index_offset
321
+ last_row = first_row + event_history.order_plan_max_rows_to_display
322
322
  if last_row >= order_plan.length
323
323
  last_row = order_plan.length - 1
324
- first_row = last_row - 7
325
- event_history.order_plan_line = first_row
324
+ first_row = last_row - event_history.order_plan_max_rows_to_display
325
+ event_history.order_plan_index_offset = first_row
326
326
  end
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
331
+
330
332
  style = :normal
331
- style = :highlight if event_history.order_plan_win_highlighted
333
+ style = :highlight if event_history.order_plan_row_to_select == current_line
332
334
  fiat_avail_out = Cryptum.beautify_large_number(
333
335
  value: order[:fiat_available]
334
336
  )
data/lib/cryptum/ui.rb CHANGED
@@ -301,8 +301,8 @@ module Cryptum
301
301
 
302
302
  # What a hack to detect up / down arrow key presses.
303
303
  key_press_event.key_ansi = true if key_press_event.key_esc && key_press == '['
304
- key_press_event.key_up = true if key_press_event.key_ansi && key_press == 'A'
305
- key_press_event.key_down = true if key_press_event.key_ansi && key_press == 'B'
304
+ key_press_event.key_up_arrow = true if key_press_event.key_ansi && key_press == 'A'
305
+ key_press_event.key_down_arrow = true if key_press_event.key_ansi && key_press == 'B'
306
306
 
307
307
  key_press_event
308
308
  rescue Interrupt
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.255'
4
+ VERSION = '0.0.256'
5
5
  end
@@ -129,40 +129,58 @@ module Cryptum
129
129
  end
130
130
 
131
131
  # Scroll Down Order Plan / Order Execution Window Panes
132
- if terminal_win.key_press_event.key_down
132
+ if terminal_win.key_press_event.key_down_arrow
133
133
  terminal_win.key_press_event.key_ansi = false
134
134
  terminal_win.key_press_event.key_esc = false
135
- terminal_win.key_press_event.key_down = false
135
+ terminal_win.key_press_event.key_down_arrow = false
136
+ if event_history.order_plan_win_active
137
+ order_plan_max_row_index = event_history.order_plan_max_rows_to_display - 1
138
+ 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
141
+ end
136
142
 
137
- event_history.order_plan_line += 1 if event_history.order_plan_win_highlighted
143
+ if event_history.order_execute_win_active
144
+ order_execute_max_row_index = event_history.order_execute_max_rows_to_display - 1
145
+ 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
138
148
 
139
- event_history.order_execute_line += 1 if event_history.order_execute_win_highlighted
149
+ end
140
150
  end
141
151
 
142
152
  # TAB through Order Plan / Order Execution Window Panes
143
153
  if terminal_win.key_press_event.key_tab
144
154
  terminal_win.key_press_event.key_tab = false
145
155
 
146
- if event_history.order_plan_win_highlighted
147
- event_history.order_plan_win_highlighted = false
148
- event_history.order_execute_win_highlighted = true
156
+ if event_history.order_plan_win_active
157
+ event_history.order_plan_win_active = false
158
+ event_history.order_execute_win_active = true
149
159
  else
150
- event_history.order_plan_win_highlighted = true
151
- event_history.order_execute_win_highlighted = false
160
+ event_history.order_plan_win_active = true
161
+ event_history.order_execute_win_active = false
152
162
  end
153
163
  end
154
164
 
155
165
  # Scroll Up Order Plan / Order Execution Window Panes
156
- if terminal_win.key_press_event.key_up
166
+ if terminal_win.key_press_event.key_up_arrow
157
167
  terminal_win.key_press_event.key_ansi = false
158
168
  terminal_win.key_press_event.key_esc = false
159
- terminal_win.key_press_event.key_up = false
169
+ terminal_win.key_press_event.key_up_arrow = false
160
170
 
161
- event_history.order_plan_line -= 1 if event_history.order_plan_win_highlighted &&
162
- event_history.order_plan_line.positive?
171
+ if event_history.order_plan_win_active
172
+ event_history.order_plan_row_to_select -= 1
173
+ event_history.order_plan_index_offset -= 1 if event_history.order_plan_row_to_select.negative?
174
+ event_history.order_plan_index_offset = 0 if event_history.order_plan_index_offset.negative?
175
+ event_history.order_plan_row_to_select = 0 if event_history.order_plan_row_to_select.negative?
176
+ end
163
177
 
164
- event_history.order_execute_line -= 1 if event_history.order_execute_win_highlighted &&
165
- event_history.order_execute_line.positive?
178
+ if event_history.order_execute_win_active
179
+ event_history.order_execute_row_to_select -= 1
180
+ event_history.order_execute_index_offset -= 1 if event_history.order_execute_row_to_select.negative?
181
+ event_history.order_execute_index_offset = 0 if event_history.order_execute_index_offset.negative?
182
+ event_history.order_execute_row_to_select = 0 if event_history.order_execute_row_to_select.negative?
183
+ end
166
184
  end
167
185
  end
168
186
 
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.255
4
+ version: 0.0.256
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.