cryptum 0.0.386 → 0.0.387
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +13 -4
- data/README.md +2 -2
- data/bin/cryptum +48 -65
- 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 -26
- 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 +2 -2
- 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 -5
- 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 +3 -2
- data/lib/cryptum/ui/key_press_event.rb +2 -5
- data/lib/cryptum/ui/market_trend.rb +2 -5
- data/lib/cryptum/ui/matrix.rb +2 -5
- data/lib/cryptum/ui/order/execute.rb +2 -5
- data/lib/cryptum/ui/order/execute_details.rb +2 -5
- data/lib/cryptum/ui/order/plan.rb +11 -6
- data/lib/cryptum/ui/order/plan_details.rb +2 -5
- data/lib/cryptum/ui/order/timer.rb +2 -5
- data/lib/cryptum/ui/portfolio.rb +6 -6
- data/lib/cryptum/ui/signal_engine.rb +2 -5
- data/lib/cryptum/ui/terminal_window.rb +2 -5
- data/lib/cryptum/ui/ticker.rb +2 -5
- 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 +14 -11
- data/lib/cryptum.rb +20 -6
- metadata +1 -1
data/lib/cryptum/event/scroll.rb
CHANGED
@@ -30,8 +30,8 @@ module Cryptum
|
|
30
30
|
event_history.order_execute_index_offset = 0 if event_history.order_execute_index_offset.negative?
|
31
31
|
event_history.order_execute_row_to_select = 0 if event_history.order_execute_row_to_select.negative?
|
32
32
|
end
|
33
|
-
rescue StandardError => e
|
34
|
-
|
33
|
+
rescue Interrupt, StandardError => e
|
34
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
35
35
|
end
|
36
36
|
|
37
37
|
# Supported Method Parameters::
|
@@ -66,8 +66,8 @@ module Cryptum
|
|
66
66
|
event_history.order_execute_index_offset += 1 if event_history.order_execute_row_to_select > event_history.order_execute_max_records_available_to_display
|
67
67
|
event_history.order_execute_row_to_select = event_history.order_execute_max_records_available_to_display if event_history.order_execute_row_to_select > event_history.order_execute_max_records_available_to_display
|
68
68
|
end
|
69
|
-
rescue StandardError => e
|
70
|
-
|
69
|
+
rescue Interrupt, StandardError => e
|
70
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
71
71
|
end
|
72
72
|
|
73
73
|
# Supported Method Parameters::
|
@@ -94,8 +94,8 @@ module Cryptum
|
|
94
94
|
event_history.order_execute_index_offset = 0 if event_history.order_execute_index_offset.negative?
|
95
95
|
event_history.order_execute_row_to_select = 0 if event_history.order_execute_row_to_select.negative?
|
96
96
|
end
|
97
|
-
rescue StandardError => e
|
98
|
-
|
97
|
+
rescue Interrupt, StandardError => e
|
98
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
99
99
|
end
|
100
100
|
|
101
101
|
# Supported Method Parameters::
|
@@ -122,8 +122,8 @@ module Cryptum
|
|
122
122
|
event_history.order_execute_row_to_select = 0
|
123
123
|
event_history.order_execute_index_offset += event_history.order_execute_max_rows_to_display + 1 unless event_history.order_execute_index_offset > order_history_meta_length
|
124
124
|
end
|
125
|
-
rescue StandardError => e
|
126
|
-
|
125
|
+
rescue Interrupt, StandardError => e
|
126
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
127
127
|
end
|
128
128
|
|
129
129
|
# Supported Method Parameters::
|
@@ -146,8 +146,8 @@ module Cryptum
|
|
146
146
|
event_history.order_execute_row_to_select = 0
|
147
147
|
event_history.order_execute_index_offset = 0
|
148
148
|
end
|
149
|
-
rescue StandardError => e
|
150
|
-
|
149
|
+
rescue Interrupt, StandardError => e
|
150
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
151
151
|
end
|
152
152
|
|
153
153
|
# Supported Method Parameters::
|
@@ -180,8 +180,8 @@ module Cryptum
|
|
180
180
|
event_history.order_execute_row_to_select = event_history.order_execute_max_records_available_to_display
|
181
181
|
event_history.order_execute_index_offset = order_history_meta_length - event_history.order_execute_max_records_available_to_display
|
182
182
|
end
|
183
|
-
rescue StandardError => e
|
184
|
-
|
183
|
+
rescue Interrupt, StandardError => e
|
184
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
185
185
|
end
|
186
186
|
|
187
187
|
# Display Usage for this Module
|
data/lib/cryptum/event/sell.rb
CHANGED
@@ -28,8 +28,8 @@ module Cryptum
|
|
28
28
|
bot_conf: bot_conf,
|
29
29
|
buy_order_id: buy_order_id
|
30
30
|
)
|
31
|
-
rescue StandardError => e
|
32
|
-
|
31
|
+
rescue Interrupt, StandardError => e
|
32
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
33
33
|
end
|
34
34
|
|
35
35
|
# Display Usage for this Module
|
data/lib/cryptum/log.rb
CHANGED
@@ -6,34 +6,54 @@ module Cryptum
|
|
6
6
|
# Supported Method Parameters::
|
7
7
|
# Cryptum::Log.create(
|
8
8
|
# )
|
9
|
-
public_class_method def self.
|
10
|
-
|
11
|
-
|
9
|
+
public_class_method def self.append(opts = {})
|
10
|
+
# Leave 10 "old" log files where
|
11
|
+
# each file is ~ 1,024,000 bytes
|
12
|
+
log_file = File.open('/tmp/cryptum.log', 'a')
|
13
|
+
logger = Logger.new(
|
14
|
+
log_file,
|
15
|
+
10,
|
16
|
+
1_024_000
|
17
|
+
)
|
18
|
+
level = opts[:level].to_s.downcase.to_sym
|
19
|
+
msg = opts[:msg]
|
20
|
+
which_self = opts[:which_self].to_s
|
21
|
+
event_history = opts[:event_history]
|
12
22
|
|
13
|
-
|
23
|
+
exit_gracefully = false
|
24
|
+
|
25
|
+
case level
|
14
26
|
when :debug
|
15
27
|
logger.level = Logger::DEBUG
|
16
28
|
when :error
|
17
29
|
logger.level = Logger::ERROR
|
30
|
+
exit_gracefully = true
|
18
31
|
when :fatal
|
32
|
+
# This is reserved for:
|
33
|
+
# Cryptum::UI::Exit
|
34
|
+
# module(s) if StandardError is triggered.
|
35
|
+
# This ensures we're not infintely attempting
|
36
|
+
# to log to file and exit.
|
19
37
|
logger.level = Logger::FATAL
|
20
38
|
when :unknown
|
21
39
|
logger.level = Logger::UNKNOWN
|
22
40
|
when :warn
|
23
41
|
logger.level = Logger::WARN
|
24
|
-
|
42
|
+
when :info
|
25
43
|
logger.level = Logger::INFO
|
44
|
+
else
|
45
|
+
raise "ERROR: Invalid log level. Valid options are:\n:info\n:warn\n:unknown\n:fatal\n:error\n:debug"
|
26
46
|
end
|
27
47
|
|
28
48
|
logger.datetime_format = '%Y-%m-%d %H:%M:%S.%N'
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
49
|
+
if msg.instance_of?(Interrupt)
|
50
|
+
logger.add(logger.level, 'CTRL+C Detected...Ended Session.', which_self)
|
51
|
+
else
|
52
|
+
logger.add(logger.level, msg, which_self)
|
33
53
|
end
|
34
54
|
|
35
|
-
|
36
|
-
rescue StandardError => e
|
55
|
+
Cryptum::UI::Exit.gracefully(event_history: event_history) if exit_gracefully
|
56
|
+
rescue Interrupt, StandardError => e
|
37
57
|
raise e
|
38
58
|
end
|
39
59
|
|
data/lib/cryptum/open_ai.rb
CHANGED
@@ -62,7 +62,8 @@ module Cryptum
|
|
62
62
|
)
|
63
63
|
|
64
64
|
else
|
65
|
-
|
65
|
+
e = "Unsupported HTTP Method #{http_method}"
|
66
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
66
67
|
end
|
67
68
|
response
|
68
69
|
rescue RestClient::ExceptionWithResponse => e
|
@@ -74,8 +75,8 @@ module Cryptum
|
|
74
75
|
f.puts "HTTP POST BODY: #{http_body.inspect}" if http_body != ''
|
75
76
|
f.puts "#{e}\n#{e.response}\n\n\n"
|
76
77
|
end
|
77
|
-
rescue StandardError => e
|
78
|
-
|
78
|
+
rescue Interrupt, StandardError => e
|
79
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
79
80
|
end
|
80
81
|
|
81
82
|
# Supported Method Parameters::
|
@@ -92,8 +93,8 @@ module Cryptum
|
|
92
93
|
)
|
93
94
|
|
94
95
|
JSON.parse(response, symbolize_names: true)
|
95
|
-
rescue StandardError => e
|
96
|
-
|
96
|
+
rescue Interrupt, StandardError => e
|
97
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
97
98
|
end
|
98
99
|
|
99
100
|
# Supported Method Parameters::
|
@@ -185,8 +186,8 @@ module Cryptum
|
|
185
186
|
end
|
186
187
|
|
187
188
|
json_resp
|
188
|
-
rescue StandardError => e
|
189
|
-
|
189
|
+
rescue Interrupt, StandardError => e
|
190
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
190
191
|
end
|
191
192
|
|
192
193
|
# Supported Method Parameters::
|
@@ -221,8 +222,8 @@ module Cryptum
|
|
221
222
|
)
|
222
223
|
|
223
224
|
JSON.parse(response, symbolize_names: true)
|
224
|
-
rescue StandardError => e
|
225
|
-
|
225
|
+
rescue Interrupt, StandardError => e
|
226
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
226
227
|
end
|
227
228
|
|
228
229
|
# Display Usage for this Module
|
@@ -16,12 +16,9 @@ module Cryptum
|
|
16
16
|
:market_trend_reset,
|
17
17
|
:market_trend_reset_label
|
18
18
|
|
19
|
-
rescue Interrupt
|
20
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
21
|
-
Cryptum::UI::Exit.gracefully
|
22
|
-
rescue StandardError => e
|
19
|
+
rescue Interrupt, StandardError => e
|
23
20
|
# Produce a Stacktrace for anything else
|
24
|
-
|
21
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
@@ -72,8 +72,8 @@ module Cryptum
|
|
72
72
|
puts `#{option_choice.driver_name} --help`
|
73
73
|
exit 1
|
74
74
|
end
|
75
|
-
rescue StandardError => e
|
76
|
-
|
75
|
+
rescue Interrupt, StandardError => e
|
76
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
77
77
|
end
|
78
78
|
|
79
79
|
# Display Usage for this Module
|
@@ -70,8 +70,8 @@ module Cryptum
|
|
70
70
|
puts "ERROR: #{e.message}\n\n"
|
71
71
|
puts `#{option_choice.driver_name} --help`
|
72
72
|
exit 1
|
73
|
-
rescue StandardError => e
|
74
|
-
|
73
|
+
rescue Interrupt, StandardError => e
|
74
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
75
75
|
end
|
76
76
|
|
77
77
|
# Display Usage for this Module
|
@@ -90,8 +90,8 @@ module Cryptum
|
|
90
90
|
end
|
91
91
|
|
92
92
|
event_history
|
93
|
-
rescue StandardError => e
|
94
|
-
|
93
|
+
rescue Interrupt, StandardError => e
|
94
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
95
95
|
end
|
96
96
|
|
97
97
|
# Display Usage for this Module
|
@@ -14,17 +14,6 @@ module Cryptum
|
|
14
14
|
event = opts[:event]
|
15
15
|
indicator_status = opts[:indicator_status]
|
16
16
|
|
17
|
-
# Compatible w/ l2update websocket channel
|
18
|
-
# buy_or_sell = event[:changes].first[0].to_s.to_sym
|
19
|
-
# case buy_or_sell
|
20
|
-
# when :buy
|
21
|
-
# event_history.order_book[:market_trend][:buy] += 1
|
22
|
-
# when :sell
|
23
|
-
# event_history.order_book[:market_trend][:sell] += 1
|
24
|
-
# else
|
25
|
-
# raise "UNKNOWN Value in event[:changes] => #{buy_or_sell}"
|
26
|
-
# end
|
27
|
-
|
28
17
|
# Compatible w/ l2update_batch websocket channel
|
29
18
|
buy_count = event[:changes].select { |change| change.first == 'buy' }.length
|
30
19
|
sell_count = event[:changes].select { |change| change.first == 'sell' }.length
|
@@ -69,8 +58,8 @@ module Cryptum
|
|
69
58
|
indicator_hash[:ui] = "Market is #{motivation} | #{trend}"
|
70
59
|
|
71
60
|
indicator_status.market_trend = indicator_hash
|
72
|
-
rescue StandardError => e
|
73
|
-
|
61
|
+
rescue Interrupt, StandardError => e
|
62
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
74
63
|
end
|
75
64
|
|
76
65
|
# public_class_method def self.reset(opts = {})
|
@@ -121,8 +110,8 @@ module Cryptum
|
|
121
110
|
# event_history.order_book[:last_trend_reset] = Time.now.strftime(
|
122
111
|
# '%Y-%m-%d %H:%M:%S.%N%z'
|
123
112
|
# )
|
124
|
-
# rescue StandardError => e
|
125
|
-
#
|
113
|
+
# rescue Interrupt, StandardError => e
|
114
|
+
# Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
126
115
|
# end
|
127
116
|
|
128
117
|
# Display Usage for this Module
|
@@ -38,8 +38,8 @@ module Cryptum
|
|
38
38
|
indicator_hash[:status] = profit_margin_status_out
|
39
39
|
|
40
40
|
indicator_status.profit_margin = indicator_hash
|
41
|
-
rescue StandardError => e
|
42
|
-
|
41
|
+
rescue Interrupt, StandardError => e
|
42
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
43
43
|
end
|
44
44
|
|
45
45
|
# Display Usage for this Module
|
@@ -106,8 +106,8 @@ module Cryptum
|
|
106
106
|
end
|
107
107
|
|
108
108
|
event_history
|
109
|
-
rescue StandardError => e
|
110
|
-
|
109
|
+
rescue Interrupt, StandardError => e
|
110
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
111
111
|
end
|
112
112
|
|
113
113
|
# Display Usage for this Module
|
data/lib/cryptum/ui/command.rb
CHANGED
@@ -291,11 +291,8 @@ module Cryptum
|
|
291
291
|
key_press_event.key_u ||
|
292
292
|
key_press_event.key_w ||
|
293
293
|
key_press_event.key_x
|
294
|
-
rescue Interrupt
|
295
|
-
|
296
|
-
Cryptum::UI::Exit.gracefully
|
297
|
-
rescue StandardError => e
|
298
|
-
raise e
|
294
|
+
rescue Interrupt, StandardError => e
|
295
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
299
296
|
end
|
300
297
|
|
301
298
|
# Display Usage for this Module
|
data/lib/cryptum/ui/exit.rb
CHANGED
@@ -10,9 +10,10 @@ module Cryptum
|
|
10
10
|
Curses.close_screen
|
11
11
|
|
12
12
|
exit 0
|
13
|
-
rescue StandardError => e
|
13
|
+
rescue Interrupt, StandardError => e
|
14
14
|
# Produce a Stacktrace for anything else
|
15
|
-
|
15
|
+
Cryptum::Log.append(level: :fatal, msg: e, which_self: self)
|
16
|
+
exit 1
|
16
17
|
ensure
|
17
18
|
if event_history
|
18
19
|
order_book_file = event_history.order_book[:path]
|
@@ -21,12 +21,9 @@ module Cryptum
|
|
21
21
|
:key_tab,
|
22
22
|
:key_up_arrow
|
23
23
|
|
24
|
-
rescue Interrupt
|
25
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
26
|
-
Cryptum::UI::Exit.gracefully
|
27
|
-
rescue StandardError => e
|
24
|
+
rescue Interrupt, StandardError => e
|
28
25
|
# Produce a Stacktrace for anything else
|
29
|
-
|
26
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
30
27
|
end
|
31
28
|
|
32
29
|
# Display a List of Every UI Module
|
@@ -53,11 +53,8 @@ module Cryptum
|
|
53
53
|
market_trend_win.refresh
|
54
54
|
|
55
55
|
event_history
|
56
|
-
rescue Interrupt
|
57
|
-
|
58
|
-
Cryptum::UI::Exit.gracefully(event_history: event_history)
|
59
|
-
rescue StandardError => e
|
60
|
-
raise e
|
56
|
+
rescue Interrupt, StandardError => e
|
57
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
61
58
|
end
|
62
59
|
|
63
60
|
# Display Usage for this Module
|
data/lib/cryptum/ui/matrix.rb
CHANGED
@@ -168,11 +168,8 @@ module Cryptum
|
|
168
168
|
end
|
169
169
|
# matrix_row += matrix_arr[Random.rand(0..last_index)]
|
170
170
|
matrix_row += matrix_arr.sample
|
171
|
-
rescue Interrupt
|
172
|
-
|
173
|
-
Cryptum::UI::Exit.gracefully
|
174
|
-
rescue StandardError => e
|
175
|
-
raise e
|
171
|
+
rescue Interrupt, StandardError => e
|
172
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
176
173
|
end
|
177
174
|
|
178
175
|
# Display Usage for this Module
|
@@ -599,11 +599,8 @@ module Cryptum
|
|
599
599
|
event_history.open_sell_orders_merge = false
|
600
600
|
|
601
601
|
event_history
|
602
|
-
rescue Interrupt
|
603
|
-
|
604
|
-
Cryptum::UI::Exit.gracefully(event_history: event_history)
|
605
|
-
rescue StandardError => e
|
606
|
-
raise e
|
602
|
+
rescue Interrupt, StandardError => e
|
603
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
607
604
|
end
|
608
605
|
|
609
606
|
# Display Usage for this Module
|
@@ -276,11 +276,8 @@ module Cryptum
|
|
276
276
|
order_execute_details_win.refresh
|
277
277
|
|
278
278
|
event_history
|
279
|
-
rescue Interrupt
|
280
|
-
|
281
|
-
Cryptum::UI::Exit.gracefully(event_history: event_history)
|
282
|
-
rescue StandardError => e
|
283
|
-
raise e
|
279
|
+
rescue Interrupt, StandardError => e
|
280
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
284
281
|
end
|
285
282
|
|
286
283
|
# Display Usage for this Module
|
@@ -40,7 +40,15 @@ module Cryptum
|
|
40
40
|
this_account = portfolio.select do |account|
|
41
41
|
account[:currency] == crypto_currency.to_s
|
42
42
|
end
|
43
|
-
|
43
|
+
if this_account.empty?
|
44
|
+
e = "ID for Crypto Currency, #{crypto_currency} Not Found"
|
45
|
+
Cryptum::Log.append(
|
46
|
+
level: :error,
|
47
|
+
msg: e,
|
48
|
+
which_self: self,
|
49
|
+
event_history: event_history
|
50
|
+
)
|
51
|
+
end
|
44
52
|
|
45
53
|
balance = format("%0.#{crypto_smallest_decimal}f", this_account.first[:balance])
|
46
54
|
fiat_portfolio = event_history.order_book[:fiat_portfolio]
|
@@ -491,11 +499,8 @@ module Cryptum
|
|
491
499
|
order_plan_win.refresh
|
492
500
|
|
493
501
|
event_history
|
494
|
-
rescue Interrupt
|
495
|
-
|
496
|
-
Cryptum::UI::Exit.gracefully(event_history: event_history)
|
497
|
-
rescue StandardError => e
|
498
|
-
raise e
|
502
|
+
rescue Interrupt, StandardError => e
|
503
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
499
504
|
end
|
500
505
|
|
501
506
|
# Display Usage for this Module
|
@@ -219,11 +219,8 @@ module Cryptum
|
|
219
219
|
order_plan_details_win.refresh
|
220
220
|
|
221
221
|
event_history
|
222
|
-
rescue Interrupt
|
223
|
-
|
224
|
-
Cryptum::UI::Exit.gracefully(event_history: event_history)
|
225
|
-
rescue StandardError => e
|
226
|
-
raise e
|
222
|
+
rescue Interrupt, StandardError => e
|
223
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
227
224
|
end
|
228
225
|
|
229
226
|
# Display Usage for this Module
|
@@ -115,11 +115,8 @@ module Cryptum
|
|
115
115
|
order_timer_win.refresh
|
116
116
|
|
117
117
|
order_countdown.to_f
|
118
|
-
rescue Interrupt
|
119
|
-
|
120
|
-
Cryptum::UI::Exit.gracefully(event_history: event_history)
|
121
|
-
rescue StandardError => e
|
122
|
-
raise e
|
118
|
+
rescue Interrupt, StandardError => e
|
119
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
123
120
|
end
|
124
121
|
|
125
122
|
# Display Usage for this Module
|
data/lib/cryptum/ui/portfolio.rb
CHANGED
@@ -38,7 +38,10 @@ module Cryptum
|
|
38
38
|
this_account = portfolio.select do |account|
|
39
39
|
account[:currency] == crypto_currency.to_s
|
40
40
|
end
|
41
|
-
|
41
|
+
if this_account.empty?
|
42
|
+
e = "ID for Crypto Currency, #{crypto_currency} Not Found"
|
43
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
44
|
+
end
|
42
45
|
|
43
46
|
balance = format("%0.#{crypto_smallest_decimal}f", this_account.first[:balance])
|
44
47
|
balance_out = Cryptum.beautify_large_number(
|
@@ -197,11 +200,8 @@ module Cryptum
|
|
197
200
|
portfolio_win.refresh
|
198
201
|
|
199
202
|
event_history
|
200
|
-
rescue Interrupt
|
201
|
-
|
202
|
-
Cryptum::UI::Exit.gracefully(event_history: event_history)
|
203
|
-
rescue StandardError => e
|
204
|
-
raise e
|
203
|
+
rescue Interrupt, StandardError => e
|
204
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
205
205
|
end
|
206
206
|
|
207
207
|
# Display Usage for this Module
|
@@ -85,11 +85,8 @@ module Cryptum
|
|
85
85
|
indicator_status.action_signal = action_signal
|
86
86
|
|
87
87
|
indicator_status
|
88
|
-
rescue Interrupt
|
89
|
-
|
90
|
-
Cryptum::UI::Exit.gracefully
|
91
|
-
rescue StandardError => e
|
92
|
-
raise e
|
88
|
+
rescue Interrupt, StandardError => e
|
89
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
93
90
|
end
|
94
91
|
|
95
92
|
# Display Usage for this Module
|
@@ -97,12 +97,9 @@ module Cryptum
|
|
97
97
|
left: 0
|
98
98
|
)
|
99
99
|
end
|
100
|
-
rescue Interrupt
|
101
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
102
|
-
Cryptum::UI::Exit.gracefully
|
103
|
-
rescue StandardError => e
|
100
|
+
rescue Interrupt, StandardError => e
|
104
101
|
# Produce a Stacktrace for anything else
|
105
|
-
|
102
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self)
|
106
103
|
end
|
107
104
|
end
|
108
105
|
end
|
data/lib/cryptum/ui/ticker.rb
CHANGED
@@ -295,11 +295,8 @@ module Cryptum
|
|
295
295
|
ticker_win.refresh
|
296
296
|
|
297
297
|
event_history
|
298
|
-
rescue Interrupt
|
299
|
-
|
300
|
-
Cryptum::UI::Exit.gracefully(event_history: event_history)
|
301
|
-
rescue StandardError => e
|
302
|
-
raise e
|
298
|
+
rescue Interrupt, StandardError => e
|
299
|
+
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
303
300
|
end
|
304
301
|
|
305
302
|
# Display Usage for this Module
|