cryptum 0.0.253 → 0.0.254

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: de7aa17b3fb681ba04be33a6deb553a69288bda764c5dd986629885e01a2b844
4
- data.tar.gz: 4cd2964dea4a496037635def94cccce1592ba2fa6d1f6b9245cbb2ffa324619d
3
+ metadata.gz: 189b9650a62af7d1ada241d68b1bb13bc6caade9fa90c99c853980cfa27eb7cf
4
+ data.tar.gz: ad999e6ae19c037efe09ae347fd9703c3a9486613d5aebe8834c0d5fbc339f93
5
5
  SHA512:
6
- metadata.gz: 18cc950260a9780e3cedc068f68e3663ff9bba8fa4be7f50e93ea047a8930dc5fe22743f3b98a9f28f8ad717ed1ac4ac7edb3dc2c74588430d78e3480ec05b34
7
- data.tar.gz: 4e9bdff3af78b80049811e4af5b4d16b63c17ab80630dc26a689c7cda9fb23615e0af0233a85aba4d2ce466e7d948b5425a9cee923191fd5fce60b25d88de62c
6
+ metadata.gz: ee711cb2ad49fee7f7a72ad77d15b5c8a194efb191b76c985a66f3ef37711c12abd8570446240eda6183c05c21a55ff6052867f98cd3c1ba974e8488fac5be94
7
+ data.tar.gz: 952c46940311f74205453d46cf39625070ee2403801b152b57ee8e98bba619e6a30d51c757820eae2e98c40cf64ae62d42b910499ee02774900eb18616535c07
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-07-06 00:27:10 UTC using RuboCop version 1.31.1.
3
+ # on 2022-11-30 17:25:04 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
@@ -103,6 +103,11 @@ Layout/TrailingWhitespace:
103
103
  - 'lib/cryptum/ui/order_plan.rb'
104
104
  - 'lib/cryptum/ui/order_timer.rb'
105
105
 
106
+ # Offense count: 1
107
+ Lint/NonLocalExitFromIterator:
108
+ Exclude:
109
+ - 'lib/cryptum/web_sock/event_machine.rb'
110
+
106
111
  # Offense count: 51
107
112
  Lint/UselessAssignment:
108
113
  Exclude:
@@ -121,28 +126,28 @@ Lint/UselessAssignment:
121
126
  - 'lib/cryptum/ui/ticker.rb'
122
127
 
123
128
  # Offense count: 38
124
- # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
129
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
125
130
  Metrics/AbcSize:
126
131
  Max: 371
127
132
 
128
133
  # Offense count: 7
129
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
130
- # IgnoredMethods: refine
134
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
135
+ # AllowedMethods: refine
131
136
  Metrics/BlockLength:
132
- Max: 84
137
+ Max: 94
133
138
 
134
139
  # Offense count: 4
135
140
  # Configuration parameters: CountBlocks.
136
141
  Metrics/BlockNesting:
137
142
  Max: 4
138
143
 
139
- # Offense count: 15
140
- # Configuration parameters: IgnoredMethods.
144
+ # Offense count: 16
145
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
141
146
  Metrics/CyclomaticComplexity:
142
147
  Max: 70
143
148
 
144
149
  # Offense count: 56
145
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
150
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
146
151
  Metrics/MethodLength:
147
152
  Max: 343
148
153
 
@@ -152,7 +157,7 @@ Metrics/ModuleLength:
152
157
  Max: 538
153
158
 
154
159
  # Offense count: 16
155
- # Configuration parameters: IgnoredMethods.
160
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
156
161
  Metrics/PerceivedComplexity:
157
162
  Max: 73
158
163
 
@@ -183,7 +188,7 @@ Style/Next:
183
188
 
184
189
  # Offense count: 4
185
190
  # This cop supports safe autocorrection (--autocorrect).
186
- # Configuration parameters: Strict, AllowedNumbers.
191
+ # Configuration parameters: Strict, AllowedNumbers, AllowedPatterns.
187
192
  Style/NumericLiterals:
188
193
  MinDigits: 7
189
194
 
data/lib/cryptum/api.rb CHANGED
@@ -438,7 +438,6 @@ module Cryptum
438
438
  public_class_method def self.cancel_all_open_orders(opts = {})
439
439
  env = opts[:env]
440
440
  option_choice = opts[:option_choice]
441
- # order_type = opts[:order_type]
442
441
  event_notes = opts[:event_notes]
443
442
 
444
443
  product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
data/lib/cryptum/event.rb CHANGED
@@ -6,7 +6,7 @@ module Cryptum
6
6
  # This plugin is used to parse Coinbase Pro Web Socket Events in the HTTP Response
7
7
  module Event
8
8
  autoload :Buy, 'cryptum/event/buy'
9
- autoload :Cancel, 'cryptum/event/cancel'
9
+ autoload :Buy, 'cryptum/event/cancel'
10
10
  autoload :History, 'cryptum/event/history'
11
11
  autoload :KeyPress, 'cryptum/event/key_press'
12
12
  autoload :Sell, 'cryptum/event/sell'
@@ -19,6 +19,14 @@ module Cryptum
19
19
  ui_win: command_win
20
20
  )
21
21
 
22
+ if key_press_event.key_c
23
+ key_c_color = :cyan
24
+ key_c_style = :reverse
25
+ else
26
+ key_c_color = :white
27
+ key_c_style = :bold
28
+ end
29
+
22
30
  if key_press_event.key_g
23
31
  key_g_color = :cyan
24
32
  key_g_style = :reverse
@@ -62,19 +70,23 @@ module Cryptum
62
70
  command_str_r2_arr = [
63
71
  "* v#{Cryptum::VERSION} >>> ",
64
72
  '[',
73
+ 'C',
74
+ ']ancel Open Orders',
75
+ ' | ',
76
+ '[',
65
77
  'G',
66
78
  ']TFO',
67
79
  ' | ',
68
80
  '[',
69
81
  'r',
70
- ']eload bot conf',
71
- ' | ',
72
- '[',
73
- 'u',
74
- ']pdate summary'
82
+ ']eload bot conf'
75
83
  ]
76
84
 
77
85
  command_str_r3_arr = [
86
+ '[',
87
+ 'u',
88
+ ']pdate summary',
89
+ ' | ',
78
90
  '[',
79
91
  'w',
80
92
  ']rite order book',
@@ -98,6 +110,7 @@ module Cryptum
98
110
  )
99
111
  command_win.clrtoeol
100
112
 
113
+ # * v#{Cryptum::VERSION} >>>
101
114
  Cryptum::UI.colorize(
102
115
  ui_win: command_win,
103
116
  color: :yellow,
@@ -105,24 +118,25 @@ module Cryptum
105
118
  string: command_str_r2_arr.first
106
119
  )
107
120
 
121
+ # [C]ancel Open Orders
108
122
  Cryptum::UI.colorize(
109
123
  ui_win: command_win,
110
- color: key_g_color,
111
- style: key_g_style,
124
+ color: key_c_color,
125
+ style: key_c_style,
112
126
  string: command_str_r2_arr[1]
113
127
  )
114
128
 
115
129
  Cryptum::UI.colorize(
116
130
  ui_win: command_win,
117
131
  color: :yellow,
118
- style: key_g_style,
132
+ style: key_c_style,
119
133
  string: command_str_r2_arr[2]
120
134
  )
121
135
 
122
136
  Cryptum::UI.colorize(
123
137
  ui_win: command_win,
124
- color: key_g_color,
125
- style: key_g_style,
138
+ color: key_c_color,
139
+ style: key_c_style,
126
140
  string: command_str_r2_arr[3]
127
141
  )
128
142
 
@@ -133,24 +147,24 @@ module Cryptum
133
147
  string: command_str_r2_arr[4]
134
148
  )
135
149
 
150
+ # [G]TFO
136
151
  Cryptum::UI.colorize(
137
152
  ui_win: command_win,
138
- color: key_r_color,
139
- style: key_r_style,
153
+ color: key_g_color,
154
+ style: key_g_style,
140
155
  string: command_str_r2_arr[5]
141
156
  )
142
157
 
143
158
  Cryptum::UI.colorize(
144
159
  ui_win: command_win,
145
160
  color: :yellow,
146
- style: key_r_style,
161
+ style: key_g_style,
147
162
  string: command_str_r2_arr[6]
148
163
  )
149
164
 
150
165
  Cryptum::UI.colorize(
151
166
  ui_win: command_win,
152
- color: key_r_color,
153
- style: key_r_style,
167
+ color: key_g_color,
154
168
  string: command_str_r2_arr[7]
155
169
  )
156
170
 
@@ -161,25 +175,26 @@ module Cryptum
161
175
  string: command_str_r2_arr[8]
162
176
  )
163
177
 
178
+ # [r]eload bot conf
164
179
  Cryptum::UI.colorize(
165
180
  ui_win: command_win,
166
- color: key_u_color,
167
- style: key_u_style,
181
+ color: key_r_color,
182
+ style: key_r_style,
168
183
  string: command_str_r2_arr[9]
169
184
  )
170
185
 
171
186
  Cryptum::UI.colorize(
172
187
  ui_win: command_win,
173
188
  color: :yellow,
174
- style: key_u_style,
189
+ style: key_r_style,
175
190
  string: command_str_r2_arr[10]
176
191
  )
177
192
 
178
193
  Cryptum::UI.colorize(
179
194
  ui_win: command_win,
180
- color: key_u_color,
181
- style: key_u_style,
182
- string: command_str_r2_arr[11]
195
+ color: key_r_color,
196
+ style: key_r_style,
197
+ string: command_str_r2_arr.last
183
198
  )
184
199
 
185
200
  # ROW 3
@@ -190,46 +205,76 @@ module Cryptum
190
205
  )
191
206
  command_win.clrtoeol
192
207
 
208
+ # [u]date summary
209
+ Cryptum::UI.colorize(
210
+ ui_win: command_win,
211
+ color: key_u_color,
212
+ string: command_str_r3_arr.first
213
+ )
214
+
215
+ Cryptum::UI.colorize(
216
+ ui_win: command_win,
217
+ color: :yellow,
218
+ style: key_u_style,
219
+ string: command_str_r3_arr[1]
220
+ )
221
+
222
+ Cryptum::UI.colorize(
223
+ ui_win: command_win,
224
+ color: key_u_color,
225
+ style: key_u_style,
226
+ string: command_str_r3_arr[2]
227
+ )
228
+
229
+ # |
230
+ Cryptum::UI.colorize(
231
+ ui_win: command_win,
232
+ color: :white,
233
+ string: command_str_r3_arr[3]
234
+ )
235
+
236
+ # [w]rite order book
193
237
  Cryptum::UI.colorize(
194
238
  ui_win: command_win,
195
239
  color: key_w_color,
196
240
  style: key_w_style,
197
- string: command_str_r3_arr.first
241
+ string: command_str_r3_arr[4]
198
242
  )
199
243
 
200
244
  Cryptum::UI.colorize(
201
245
  ui_win: command_win,
202
246
  color: :yellow,
203
247
  style: key_w_style,
204
- string: command_str_r3_arr[1]
248
+ string: command_str_r3_arr[5]
205
249
  )
206
250
 
207
251
  Cryptum::UI.colorize(
208
252
  ui_win: command_win,
209
253
  color: key_w_color,
210
254
  style: key_w_style,
211
- string: command_str_r3_arr[2]
255
+ string: command_str_r3_arr[6]
212
256
  )
213
257
 
214
258
  # |
215
259
  Cryptum::UI.colorize(
216
260
  ui_win: command_win,
217
261
  color: :white,
218
- string: command_str_r3_arr[3]
262
+ string: command_str_r3_arr[7]
219
263
  )
220
264
 
265
+ # e[x]it
221
266
  Cryptum::UI.colorize(
222
267
  ui_win: command_win,
223
268
  color: key_x_color,
224
269
  style: key_x_style,
225
- string: command_str_r3_arr[4]
270
+ string: command_str_r3_arr[8]
226
271
  )
227
272
 
228
273
  Cryptum::UI.colorize(
229
274
  ui_win: command_win,
230
275
  color: :yellow,
231
276
  style: key_x_style,
232
- string: command_str_r3_arr[5]
277
+ string: command_str_r3_arr[9]
233
278
  )
234
279
 
235
280
  Cryptum::UI.colorize(
@@ -4,7 +4,8 @@ module Cryptum
4
4
  module UI
5
5
  # This Class is Used to Detect Key Press Events
6
6
  class KeyPressEvent
7
- attr_accessor :key_g,
7
+ attr_accessor :key_c,
8
+ :key_g,
8
9
  :key_r,
9
10
  :key_u,
10
11
  :key_w,
@@ -47,7 +47,10 @@ module Cryptum
47
47
  color = indicator_status.market_trend[:color] if indicator_status.market_trend
48
48
  case color
49
49
  when :green
50
- intent = "- Waiting for Open Sell Orders to Trigger -"
50
+ # TODO: add condition to check if open sell orders exist.
51
+ # If so intent should be something like, "- SEE LIMIT SELL ORDERS -"
52
+ # Otherwise, intent should be something like, "- WAIT FOR MARKET TREND SHIFT -"
53
+ intent = "- SEE LIMIT SELL ORDERS -"
51
54
  else
52
55
  trend = 'BEAR'
53
56
  speed = 'FAST'
@@ -56,7 +59,7 @@ module Cryptum
56
59
  speed = 'SLOW'
57
60
  end
58
61
 
59
- intent = "#{speed} #{trend} BUY: #{order_countdown} of #{time_between_order_exec_out}"
62
+ intent = "#{trend} - #{speed} BUY: #{order_countdown} of #{time_between_order_exec_out}"
60
63
  intent = '- BUYING PAUSED -' if event_history.red_pill
61
64
  end
62
65
 
@@ -209,7 +209,7 @@ module Cryptum
209
209
  ui_win: ticker_win,
210
210
  color: :white,
211
211
  style: :bold,
212
- string: 'Highest | Lowest Sell Price:'
212
+ string: 'High | Low Limit Sell Prices:'
213
213
  )
214
214
 
215
215
  ticker_win.setpos(out_line_no, Cryptum::UI.col_third)
data/lib/cryptum/ui.rb CHANGED
@@ -275,6 +275,8 @@ module Cryptum
275
275
  ui_win = opts[:ui_win]
276
276
 
277
277
  case ui_win.getch
278
+ when 'C'
279
+ key_press_event.key_c = true
278
280
  when 'G'
279
281
  key_press_event.key_g = true
280
282
  when 'r'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.253'
4
+ VERSION = '0.0.254'
5
5
  end
@@ -54,6 +54,7 @@ module Cryptum
54
54
 
55
55
  ws.on :message do |event|
56
56
  ai_enabled = bot_conf[:artifical_intelligence]
57
+
57
58
  event_history.event = JSON.parse(
58
59
  event.data,
59
60
  symbolize_names: true
@@ -77,6 +78,16 @@ module Cryptum
77
78
  # Detect Key Press Events
78
79
  Cryptum::Event::KeyPress.detect(terminal_win: terminal_win)
79
80
 
81
+ # Cancel ALL Open Orders when
82
+ # C is pressed
83
+ if terminal_win.key_press_event.key_c
84
+ Cryptum::API.cancel_all_open_orders(
85
+ env: env,
86
+ option_choice: option_choice
87
+ )
88
+ terminal_win.key_press_event.key_c = false
89
+ end
90
+
80
91
  # Get the F* Out (GTFO) when
81
92
  # G is pressed
82
93
  if terminal_win.key_press_event.key_g
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.253
4
+ version: 0.0.254
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-29 00:00:00.000000000 Z
11
+ date: 2022-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable