cryptum 0.0.385 → 0.0.387
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 +4 -4
- data/.rubocop_todo.yml +13 -4
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/bin/cryptum +48 -61
- data/git_commit.sh +1 -0
- data/lib/cryptum/api/exchange_rates.rb +2 -2
- data/lib/cryptum/api/fees.rb +2 -2
- data/lib/cryptum/api/order_history.rb +2 -2
- data/lib/cryptum/api/orders.rb +8 -8
- data/lib/cryptum/api/portfolio.rb +2 -2
- data/lib/cryptum/api/products.rb +4 -4
- data/lib/cryptum/api/rest.rb +22 -24
- data/lib/cryptum/api/signature.rb +2 -2
- data/lib/cryptum/bot_conf.rb +7 -29
- data/lib/cryptum/event/bot_conf.rb +2 -2
- data/lib/cryptum/event/buy.rb +2 -2
- data/lib/cryptum/event/cancel.rb +2 -5
- data/lib/cryptum/event/exit.rb +3 -12
- data/lib/cryptum/event/gtfo.rb +2 -2
- data/lib/cryptum/event/history.rb +2 -8
- data/lib/cryptum/event/key_press.rb +2 -2
- data/lib/cryptum/event/order_book.rb +2 -2
- data/lib/cryptum/event/pane.rb +4 -4
- data/lib/cryptum/event/parse.rb +2 -10
- data/lib/cryptum/event/scroll.rb +12 -12
- data/lib/cryptum/event/sell.rb +2 -2
- data/lib/cryptum/log.rb +31 -11
- data/lib/cryptum/open_ai.rb +10 -9
- data/lib/cryptum/option/choice.rb +2 -6
- data/lib/cryptum/option/environment.rb +2 -2
- data/lib/cryptum/option/input_validation.rb +2 -2
- data/lib/cryptum/option/parser.rb +2 -2
- data/lib/cryptum/order_book/generate.rb +2 -2
- data/lib/cryptum/order_book/market_trend.rb +4 -15
- data/lib/cryptum/order_book/profit_margin.rb +2 -2
- data/lib/cryptum/portfolio/balance.rb +2 -2
- data/lib/cryptum/ui/command.rb +2 -5
- data/lib/cryptum/ui/exit.rb +9 -18
- data/lib/cryptum/ui/key_press_event.rb +2 -6
- data/lib/cryptum/ui/market_trend.rb +2 -8
- data/lib/cryptum/ui/matrix.rb +2 -5
- data/lib/cryptum/ui/order/execute.rb +2 -10
- data/lib/cryptum/ui/order/execute_details.rb +2 -8
- data/lib/cryptum/ui/order/plan.rb +11 -10
- data/lib/cryptum/ui/order/plan_details.rb +2 -8
- data/lib/cryptum/ui/order/timer.rb +2 -9
- data/lib/cryptum/ui/portfolio.rb +6 -10
- data/lib/cryptum/ui/signal_engine.rb +2 -5
- data/lib/cryptum/ui/terminal_window.rb +2 -6
- data/lib/cryptum/ui/ticker.rb +2 -8
- data/lib/cryptum/ui.rb +24 -61
- data/lib/cryptum/version.rb +1 -1
- data/lib/cryptum/web_sock/coinbase.rb +4 -7
- data/lib/cryptum/web_sock/event_machine.rb +15 -24
- data/lib/cryptum.rb +20 -7
- metadata +4 -4
data/lib/cryptum/ui.rb
CHANGED
@@ -46,13 +46,9 @@ module Cryptum
|
|
46
46
|
# This object is used to pass all of the UI sections
|
47
47
|
# around to various Cryptum modules
|
48
48
|
Cryptum::UI::TerminalWindow.new
|
49
|
-
rescue Interrupt
|
50
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
51
|
-
Cryptum::UI::Exit.gracefully(which_self: self)
|
52
|
-
rescue StandardError => e
|
49
|
+
rescue Interrupt, StandardError => e
|
53
50
|
# Produce a Stacktrace for anything else
|
54
|
-
|
55
|
-
raise e
|
51
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
56
52
|
end
|
57
53
|
|
58
54
|
# Create New Curses Window
|
@@ -71,13 +67,10 @@ module Cryptum
|
|
71
67
|
window.nodelay = true
|
72
68
|
|
73
69
|
window
|
74
|
-
rescue Interrupt
|
75
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
76
|
-
Cryptum::UI::Exit.gracefully(which_self: self)
|
77
|
-
rescue StandardError => e
|
70
|
+
rescue Interrupt, StandardError => e
|
78
71
|
# Produce a Stacktrace for anything else
|
79
72
|
Curses.close_screen
|
80
|
-
|
73
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
81
74
|
end
|
82
75
|
|
83
76
|
# Draw a Box Around a Window
|
@@ -97,13 +90,9 @@ module Cryptum
|
|
97
90
|
style: style,
|
98
91
|
string: "\u2500" * Curses.cols
|
99
92
|
)
|
100
|
-
rescue Interrupt
|
101
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
102
|
-
Cryptum::UI::Exit.gracefully(which_self: self)
|
103
|
-
rescue StandardError => e
|
93
|
+
rescue Interrupt, StandardError => e
|
104
94
|
# Produce a Stacktrace for anything else
|
105
|
-
|
106
|
-
raise e
|
95
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
107
96
|
end
|
108
97
|
|
109
98
|
# Jump to First Column
|
@@ -173,7 +162,8 @@ module Cryptum
|
|
173
162
|
color_fg = color_id
|
174
163
|
color_bg = bg
|
175
164
|
else
|
176
|
-
|
165
|
+
e = "Color Not Implemented for this Method: #{color}"
|
166
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
177
167
|
end
|
178
168
|
|
179
169
|
case style
|
@@ -188,20 +178,17 @@ module Cryptum
|
|
188
178
|
when :reverse
|
189
179
|
font = Curses::A_REVERSE
|
190
180
|
else
|
191
|
-
|
181
|
+
e = "Font Style Not Implemented for this Method: #{style}"
|
182
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
192
183
|
end
|
193
184
|
|
194
185
|
Curses.init_pair(color_id, color_fg, color_bg)
|
195
186
|
ui_win.attron(Curses.color_pair(color_id) | font) do
|
196
187
|
ui_win.addstr(string)
|
197
188
|
end
|
198
|
-
rescue Interrupt
|
199
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
200
|
-
Cryptum::UI::Exit.gracefully(which_self: self)
|
201
|
-
rescue StandardError => e
|
189
|
+
rescue Interrupt, StandardError => e
|
202
190
|
# Produce a Stacktrace for anything else
|
203
|
-
|
204
|
-
raise e
|
191
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
205
192
|
end
|
206
193
|
|
207
194
|
# Jump to First Column
|
@@ -210,60 +197,40 @@ module Cryptum
|
|
210
197
|
|
211
198
|
str_divided_by_two = str.length / 2
|
212
199
|
(Curses.cols / 2) - str_divided_by_two
|
213
|
-
rescue Interrupt
|
214
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
215
|
-
Cryptum::UI::Exit.gracefully(which_self: self)
|
216
|
-
rescue StandardError => e
|
200
|
+
rescue Interrupt, StandardError => e
|
217
201
|
# Produce a Stacktrace for anything else
|
218
|
-
|
219
|
-
raise e
|
202
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
220
203
|
end
|
221
204
|
|
222
205
|
public_class_method def self.col_first
|
223
206
|
0
|
224
|
-
rescue Interrupt
|
225
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
226
|
-
Cryptum::UI::Exit.gracefully(which_self: self)
|
227
|
-
rescue StandardError => e
|
207
|
+
rescue Interrupt, StandardError => e
|
228
208
|
# Produce a Stacktrace for anything else
|
229
|
-
|
230
|
-
raise e
|
209
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
231
210
|
end
|
232
211
|
|
233
212
|
# Jump to Second Column
|
234
213
|
public_class_method def self.col_second
|
235
214
|
(Curses.cols / 8) + 5
|
236
|
-
rescue Interrupt
|
237
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
238
|
-
Cryptum::UI::Exit.gracefully(which_self: self)
|
239
|
-
rescue StandardError => e
|
215
|
+
rescue Interrupt, StandardError => e
|
240
216
|
# Produce a Stacktrace for anything else
|
241
|
-
|
242
|
-
raise e
|
217
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
243
218
|
end
|
244
219
|
|
245
220
|
# Jump to Third Column
|
246
221
|
public_class_method def self.col_third
|
247
222
|
((Curses.cols / 8) * 3) + 2
|
248
|
-
rescue Interrupt
|
249
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
250
|
-
Cryptum::UI::Exit.gracefully(which_self: self)
|
251
|
-
rescue StandardError => e
|
223
|
+
rescue Interrupt, StandardError => e
|
252
224
|
# Produce a Stacktrace for anything else
|
253
|
-
|
254
|
-
raise e
|
225
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
255
226
|
end
|
256
227
|
|
257
228
|
# Jump to Fourth Column
|
258
229
|
public_class_method def self.col_fourth
|
259
230
|
((Curses.cols / 4) * 3) - 3
|
260
|
-
rescue Interrupt
|
261
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
262
|
-
Cryptum::UI::Exit.gracefully(which_self: self)
|
263
|
-
rescue StandardError => e
|
231
|
+
rescue Interrupt, StandardError => e
|
264
232
|
# Produce a Stacktrace for anything else
|
265
|
-
|
266
|
-
raise e
|
233
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
267
234
|
end
|
268
235
|
|
269
236
|
public_class_method def self.detect_key_press_in_ui(opts = {})
|
@@ -320,13 +287,9 @@ module Cryptum
|
|
320
287
|
end
|
321
288
|
|
322
289
|
key_press_event
|
323
|
-
rescue Interrupt
|
324
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
325
|
-
Cryptum::UI::Exit.gracefully(which_self: self)
|
326
|
-
rescue StandardError => e
|
290
|
+
rescue Interrupt, StandardError => e
|
327
291
|
# Produce a Stacktrace for anything else
|
328
|
-
|
329
|
-
raise e
|
292
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
330
293
|
end
|
331
294
|
|
332
295
|
# Display a List of Every UI Module
|
data/lib/cryptum/version.rb
CHANGED
@@ -48,11 +48,8 @@ module Cryptum
|
|
48
48
|
end
|
49
49
|
|
50
50
|
ws
|
51
|
-
rescue Interrupt
|
52
|
-
|
53
|
-
Cryptum::UI::Exit.gracefully(which_self: self)
|
54
|
-
rescue StandardError => e
|
55
|
-
raise e
|
51
|
+
rescue Interrupt, StandardError => e
|
52
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
56
53
|
end
|
57
54
|
|
58
55
|
public_class_method def self.subscribe_message(opts = {})
|
@@ -84,8 +81,8 @@ module Cryptum
|
|
84
81
|
\"timestamp\": \"#{api_timestamp}\",
|
85
82
|
\"signature\": \"#{api_signature}\"
|
86
83
|
}"
|
87
|
-
rescue StandardError => e
|
88
|
-
|
84
|
+
rescue Interrupt, StandardError => e
|
85
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
89
86
|
end
|
90
87
|
|
91
88
|
# Display Usage for this Module
|
@@ -114,14 +114,7 @@ module Cryptum
|
|
114
114
|
end
|
115
115
|
|
116
116
|
# Exit if x is Pressed
|
117
|
-
if terminal_win.key_press_event.key_x
|
118
|
-
Cryptum::Event::Exit.gracefully(
|
119
|
-
terminal_win: terminal_win,
|
120
|
-
event_history: event_history,
|
121
|
-
option_choice: option_choice,
|
122
|
-
env: env
|
123
|
-
)
|
124
|
-
end
|
117
|
+
Cryptum::Event::Exit.gracefully(event_history: event_history) if terminal_win.key_press_event.key_x
|
125
118
|
|
126
119
|
# TAB through Order Plan / Order Execution Window Panes
|
127
120
|
if terminal_win.key_press_event.key_tab
|
@@ -189,6 +182,9 @@ module Cryptum
|
|
189
182
|
end
|
190
183
|
|
191
184
|
ws.on :close do
|
185
|
+
# raise when remote peer forces reset...this
|
186
|
+
# is then caught below and reattempts to connect
|
187
|
+
# until conn_attempt > max_conn_attempts
|
192
188
|
raise Errno::ECONNRESET
|
193
189
|
end
|
194
190
|
|
@@ -237,29 +233,24 @@ module Cryptum
|
|
237
233
|
Errno::ECONNRESET,
|
238
234
|
LoadError => e
|
239
235
|
|
240
|
-
|
241
|
-
f.puts Time.now.strftime('%Y-%m-%d %H:%M:%S.%N %z')
|
242
|
-
f.puts "Module: #{self}"
|
243
|
-
f.puts "#{e}\n\n\n"
|
244
|
-
end
|
236
|
+
Cryptum::Log.append(level: :debug, msg: e, which_self: self)
|
245
237
|
|
246
|
-
|
238
|
+
if conn_attempt > max_conn_attempts
|
239
|
+
Cryptum::Log.append(
|
240
|
+
level: :error,
|
241
|
+
msg: e,
|
242
|
+
which_self: self,
|
243
|
+
event_history: event_history
|
244
|
+
)
|
245
|
+
end
|
247
246
|
|
248
247
|
sleep 1
|
249
248
|
retry
|
250
249
|
ensure
|
251
250
|
$stdout.flush
|
252
251
|
end
|
253
|
-
rescue Interrupt
|
254
|
-
|
255
|
-
Cryptum::UI::Exit.gracefully(
|
256
|
-
which_self: self,
|
257
|
-
event_history: event_history,
|
258
|
-
option_choice: option_choice,
|
259
|
-
env: env
|
260
|
-
)
|
261
|
-
rescue StandardError => e
|
262
|
-
raise e
|
252
|
+
rescue Interrupt, StandardError => e
|
253
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
263
254
|
end
|
264
255
|
|
265
256
|
# Display Usage for this Module
|
data/lib/cryptum.rb
CHANGED
@@ -37,38 +37,56 @@ module Cryptum
|
|
37
37
|
|
38
38
|
public_class_method def self.bin
|
39
39
|
File.join root, 'bin'
|
40
|
+
rescue Interrupt, StandardError => e
|
41
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
40
42
|
end
|
41
43
|
|
42
44
|
public_class_method def self.etc
|
43
45
|
File.join root, 'etc'
|
46
|
+
rescue Interrupt, StandardError => e
|
47
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
44
48
|
end
|
45
49
|
|
46
50
|
public_class_method def self.lib
|
47
51
|
File.join root, 'lib'
|
52
|
+
rescue Interrupt, StandardError => e
|
53
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
48
54
|
end
|
49
55
|
|
50
56
|
public_class_method def self.order_book
|
51
57
|
File.join root, 'order_book'
|
58
|
+
rescue Interrupt, StandardError => e
|
59
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
52
60
|
end
|
53
61
|
|
54
62
|
public_class_method def self.root
|
55
63
|
File.dirname __dir__
|
64
|
+
rescue Interrupt, StandardError => e
|
65
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
56
66
|
end
|
57
67
|
|
58
68
|
public_class_method def self.open_symbol
|
59
69
|
"\u00f8"
|
70
|
+
rescue Interrupt, StandardError => e
|
71
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
60
72
|
end
|
61
73
|
|
62
74
|
public_class_method def self.up_arrow
|
63
75
|
"\u2191"
|
76
|
+
rescue Interrupt, StandardError => e
|
77
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
64
78
|
end
|
65
79
|
|
66
80
|
public_class_method def self.down_arrow
|
67
81
|
"\u2193"
|
82
|
+
rescue Interrupt, StandardError => e
|
83
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
68
84
|
end
|
69
85
|
|
70
86
|
public_class_method def self.flat_arrow
|
71
87
|
'_'
|
88
|
+
rescue Interrupt, StandardError => e
|
89
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
72
90
|
end
|
73
91
|
|
74
92
|
# Add Commas to Large Numbers to Make it Easier to Read
|
@@ -88,13 +106,8 @@ module Cryptum
|
|
88
106
|
beautify_num = "-#{beautify_whole}.#{fraction}" if is_negative
|
89
107
|
|
90
108
|
beautify_num
|
91
|
-
rescue Interrupt
|
92
|
-
|
93
|
-
Cryptum.exit_gracefully(which_self: self)
|
94
|
-
rescue StandardError => e
|
95
|
-
# Produce a Stacktrace for anything else
|
96
|
-
Curses.close_screen
|
97
|
-
raise e
|
109
|
+
rescue Interrupt, StandardError => e
|
110
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
98
111
|
end
|
99
112
|
|
100
113
|
public_class_method def self.help
|
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.
|
4
|
+
version: 0.0.387
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -226,14 +226,14 @@ dependencies:
|
|
226
226
|
requirements:
|
227
227
|
- - '='
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: 1.
|
229
|
+
version: 1.49.0
|
230
230
|
type: :runtime
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
234
|
- - '='
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version: 1.
|
236
|
+
version: 1.49.0
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: rubocop-rake
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|