cryptum 0.0.386 → 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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +13 -4
  3. data/README.md +2 -2
  4. data/bin/cryptum +48 -65
  5. data/git_commit.sh +1 -0
  6. data/lib/cryptum/api/exchange_rates.rb +2 -2
  7. data/lib/cryptum/api/fees.rb +2 -2
  8. data/lib/cryptum/api/order_history.rb +2 -2
  9. data/lib/cryptum/api/orders.rb +8 -8
  10. data/lib/cryptum/api/portfolio.rb +2 -2
  11. data/lib/cryptum/api/products.rb +4 -4
  12. data/lib/cryptum/api/rest.rb +22 -24
  13. data/lib/cryptum/api/signature.rb +2 -2
  14. data/lib/cryptum/bot_conf.rb +7 -26
  15. data/lib/cryptum/event/bot_conf.rb +2 -2
  16. data/lib/cryptum/event/buy.rb +2 -2
  17. data/lib/cryptum/event/cancel.rb +2 -5
  18. data/lib/cryptum/event/exit.rb +2 -2
  19. data/lib/cryptum/event/gtfo.rb +2 -2
  20. data/lib/cryptum/event/history.rb +2 -8
  21. data/lib/cryptum/event/key_press.rb +2 -2
  22. data/lib/cryptum/event/order_book.rb +2 -2
  23. data/lib/cryptum/event/pane.rb +4 -4
  24. data/lib/cryptum/event/parse.rb +2 -10
  25. data/lib/cryptum/event/scroll.rb +12 -12
  26. data/lib/cryptum/event/sell.rb +2 -2
  27. data/lib/cryptum/log.rb +31 -11
  28. data/lib/cryptum/open_ai.rb +10 -9
  29. data/lib/cryptum/option/choice.rb +2 -5
  30. data/lib/cryptum/option/environment.rb +2 -2
  31. data/lib/cryptum/option/input_validation.rb +2 -2
  32. data/lib/cryptum/option/parser.rb +2 -2
  33. data/lib/cryptum/order_book/generate.rb +2 -2
  34. data/lib/cryptum/order_book/market_trend.rb +4 -15
  35. data/lib/cryptum/order_book/profit_margin.rb +2 -2
  36. data/lib/cryptum/portfolio/balance.rb +2 -2
  37. data/lib/cryptum/ui/command.rb +2 -5
  38. data/lib/cryptum/ui/exit.rb +3 -2
  39. data/lib/cryptum/ui/key_press_event.rb +2 -5
  40. data/lib/cryptum/ui/market_trend.rb +2 -5
  41. data/lib/cryptum/ui/matrix.rb +2 -5
  42. data/lib/cryptum/ui/order/execute.rb +2 -5
  43. data/lib/cryptum/ui/order/execute_details.rb +2 -5
  44. data/lib/cryptum/ui/order/plan.rb +11 -6
  45. data/lib/cryptum/ui/order/plan_details.rb +2 -5
  46. data/lib/cryptum/ui/order/timer.rb +2 -5
  47. data/lib/cryptum/ui/portfolio.rb +6 -6
  48. data/lib/cryptum/ui/signal_engine.rb +2 -5
  49. data/lib/cryptum/ui/terminal_window.rb +2 -5
  50. data/lib/cryptum/ui/ticker.rb +2 -5
  51. data/lib/cryptum/ui.rb +24 -61
  52. data/lib/cryptum/version.rb +1 -1
  53. data/lib/cryptum/web_sock/coinbase.rb +4 -7
  54. data/lib/cryptum/web_sock/event_machine.rb +14 -11
  55. data/lib/cryptum.rb +20 -6
  56. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5326c18bca5498dc766a763307c15c2b10e2424417f70125c858d12b3dbe497d
4
- data.tar.gz: bc48615fe7fc8794749031a1dc08417ca7945a534bee74f6fc592b2dcdd1c738
3
+ metadata.gz: 0e9169a592ad25d86eeb7b4d34576223135b1e8fda2ad3ec7736761abcfef378
4
+ data.tar.gz: 6bdec8afaac4ca9664aa84a5c353c2d4e0c6a2f86bbce355ca472b5addde18bc
5
5
  SHA512:
6
- metadata.gz: e73499a8ed1543920e925621a76d94955ef772fa9ff8f7a7a80426487c1efc03d3dd0a9aad84bbfd06718b48f7ad70aad37dc5f409bda4eb93b22d2980ae9508
7
- data.tar.gz: 0300f39bd3215071819f2eba942433927dedcd19e90125663afcb7e89b3e415b39627be1f24cda41eda79515d98ffd36fa4777473f5dacc0ce787b67bf9a87b6
6
+ metadata.gz: 2d5a4d140e7a16dd90f38f683395f67d6d8ae2c5ccceffb578943552979d59cacadca9479c4b909fa1ac93a98021d17e16f67a1226324707d43cf39274fcad5e
7
+ data.tar.gz: acd010460f5db7aee817acc3e3d36a0f7196fb5fc0e3be0f530585599375afcb44b4ba5dd25cdd9f3f361b031b483588835b6875d694fe2fe880c437db090745
data/.rubocop_todo.yml CHANGED
@@ -1,12 +1,22 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-03-31 21:49:04 UTC using RuboCop version 1.48.1.
3
+ # on 2023-04-03 17:23:47 UTC using RuboCop version 1.49.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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 7
9
+ # Offense count: 1
10
+ Lint/UnreachableCode:
11
+ Exclude:
12
+ - 'bin/cryptum'
13
+
14
+ # Offense count: 1
15
+ Style/ClassVars:
16
+ Exclude:
17
+ - 'bin/cryptum'
18
+
19
+ # Offense count: 5
10
20
  # This cop supports safe autocorrection (--autocorrect).
11
21
  # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
12
22
  # SupportedStyles: assign_to_condition, assign_inside_condition
@@ -15,9 +25,8 @@ Style/ConditionalAssignment:
15
25
  - 'lib/cryptum/event/pane.rb'
16
26
  - 'lib/cryptum/log.rb'
17
27
  - 'lib/cryptum/ui/order/execute_details.rb'
18
- - 'lib/cryptum/ui/order_execute_details.rb'
19
28
 
20
- # Offense count: 30
29
+ # Offense count: 28
21
30
  # Configuration parameters: AllowedConstants.
22
31
  Style/Documentation:
23
32
  Enabled: false
data/README.md CHANGED
@@ -108,9 +108,9 @@ If you choose a lower value than the default, the target profit margin's (i.e. T
108
108
 
109
109
  Another option (particularly useful with smaller balances) is bumping the market trend reset to 604800 (i.e. 1 week) which will immediately increase the TPM %'s. The downside to this approach is trading volume is reduced, resulting in higher maker & taker fee tiers (i.e. higher cost / trade).
110
110
 
111
- From an error monitoring perspective, they can be monitored via:
111
+ From an logging perspective, they can be monitored via:
112
112
  ```
113
- tail -f /tmp/cryptum-errors.txt
113
+ tail -f /tmp/cryptum.log
114
114
  ```
115
115
 
116
116
  ### **Contributing** ###
data/bin/cryptum CHANGED
@@ -4,74 +4,57 @@
4
4
 
5
5
  require 'cryptum'
6
6
 
7
- begin
8
- start_time = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
9
- # Initialize Driver Name & Parse cryptum Flags
10
- driver_name = File.basename($PROGRAM_NAME)
11
- option_choice = Cryptum::Option::Parser.get(driver_name: driver_name)
7
+ start_time = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
8
+ # Initialize Driver Name & Parse cryptum Flags
9
+ driver_name = File.basename($PROGRAM_NAME)
10
+ option_choice = Cryptum::Option::Parser.get(driver_name: driver_name)
12
11
 
13
- # Initialize the Respective Environment / API Authentication Artifacts
14
- env = Cryptum::Option::Environment.get(option_choice: option_choice)
12
+ # Initialize the Respective Environment / API Authentication Artifacts
13
+ env = Cryptum::Option::Environment.get(option_choice: option_choice)
15
14
 
16
- # Dump out supported products if --list-products flag is passed and exit
17
- if option_choice.list_products
18
- Cryptum::API::Products.list_and_exit(
19
- option_choice: option_choice,
20
- env: env
21
- )
22
- end
23
-
24
- # Instantiate Our Status Indicators & History Objects
25
- indicator_status = Cryptum::OrderBook::Indicator.new
26
-
27
- # Initialize Curses UI
28
- terminal_win = Cryptum::UI.init
29
-
30
- # Generate an Order Book for Session Tracking
31
- # Load previous order_book_justification from
32
- # Order Book File (if it exists)
33
- event_history = Cryptum::OrderBook::Generate.new(
34
- start_time: start_time,
15
+ # Dump out supported products if --list-products flag is passed and exit
16
+ if option_choice.list_products
17
+ Cryptum::API::Products.list_and_exit(
35
18
  option_choice: option_choice,
36
19
  env: env
37
20
  )
38
- terminal_win.key_press_event.key_w = true if option_choice.reset_session_countdown
39
-
40
- # Automatically Create Bot Confs if they don't
41
- # Exist and Initialize Automated Trading Parameters
42
- bot_conf = Cryptum::BotConf.read(
43
- option_choice: option_choice,
44
- event_history: event_history
45
- )
46
-
47
- # Connect to WebSocket
48
- # Trigger Events as Event Data
49
- # Generated via Coinbase Pro
50
- # Web Socket HTTP Responses
51
- # Refresh UI with Event Data
52
- # Update "Status Indicators"
53
- # Leverage "Status Indicators" to Initiate Actions
54
- Cryptum::WebSock::EventMachine.run(
55
- option_choice: option_choice,
56
- env: env,
57
- terminal_win: terminal_win,
58
- event_history: event_history,
59
- indicator_status: indicator_status,
60
- bot_conf: bot_conf
61
- )
62
- rescue Interrupt
63
- # Exit Gracefully if CTRL+C is Pressed During Session
64
- puts 'CTRL+C Detected...Good Bye.'
65
- Cryptum::UI::Exit.gracefully(event_history: event_history)
66
- rescue StandardError => e
67
- # Produce a Stacktrace for anything else
68
- Curses.close_screen
69
- raise e
70
- # TODO: everything should be returned to this
71
- # single ensure block for exiting gracefully,
72
- # however, that means event_history will need
73
- # to be returned back to this driver prior to
74
- # exit.
75
- # ensure
76
- # Cryptum::UI::Exit.gracefully(event_history: event_history)
77
21
  end
22
+
23
+ # Instantiate Our Status Indicators & History Objects
24
+ indicator_status = Cryptum::OrderBook::Indicator.new
25
+
26
+ # Initialize Curses UI
27
+ terminal_win = Cryptum::UI.init
28
+
29
+ # Generate an Order Book for Session Tracking
30
+ # Load previous order_book_justification from
31
+ # Order Book File (if it exists)
32
+ event_history = Cryptum::OrderBook::Generate.new(
33
+ start_time: start_time,
34
+ option_choice: option_choice,
35
+ env: env
36
+ )
37
+ terminal_win.key_press_event.key_w = true if option_choice.reset_session_countdown
38
+
39
+ # Automatically Create Bot Confs if they don't
40
+ # Exist and Initialize Automated Trading Parameters
41
+ bot_conf = Cryptum::BotConf.read(
42
+ option_choice: option_choice,
43
+ event_history: event_history
44
+ )
45
+
46
+ # Connect to WebSocket
47
+ # Trigger Events as Event Data
48
+ # Generated via Coinbase Pro
49
+ # Web Socket HTTP Responses
50
+ # Refresh UI with Event Data
51
+ # Update "Status Indicators"
52
+ # Leverage "Status Indicators" to Initiate Actions
53
+ Cryptum::WebSock::EventMachine.run(
54
+ option_choice: option_choice,
55
+ env: env,
56
+ terminal_win: terminal_win,
57
+ event_history: event_history,
58
+ indicator_status: indicator_status,
59
+ bot_conf: bot_conf
60
+ )
data/git_commit.sh CHANGED
@@ -16,6 +16,7 @@ if [[ $1 != "" && $2 != "" && $3 != "" ]]; then
16
16
  this_version=`ruby -r 'cryptum' -e 'print Cryptum::VERSION'`
17
17
  echo "Tagging: ${this_version}"
18
18
  git tag $this_version
19
+ git push origin $this_version
19
20
  fi
20
21
  else
21
22
  echo "USAGE: ${0} '<full name>' <email address> '<git commit comments>'"
@@ -22,8 +22,8 @@ module Cryptum
22
22
  api_endpoint: api_endpoint,
23
23
  api_call: exchange_rates_api_call
24
24
  )
25
- rescue StandardError => e
26
- raise e
25
+ rescue Interrupt, StandardError => e
26
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
27
27
  end
28
28
 
29
29
  # Display Usage for this Module
@@ -18,8 +18,8 @@ module Cryptum
18
18
  http_method: :GET,
19
19
  api_call: fees_api_call
20
20
  )
21
- rescue StandardError => e
22
- raise e
21
+ rescue Interrupt, StandardError => e
22
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
23
23
  end
24
24
 
25
25
  # Display Usage for this Module
@@ -39,8 +39,8 @@ module Cryptum
39
39
  end
40
40
 
41
41
  order_history
42
- rescue StandardError => e
43
- raise e
42
+ rescue Interrupt, StandardError => e
43
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
44
44
  end
45
45
 
46
46
  # Display Usage for this Module
@@ -83,8 +83,8 @@ module Cryptum
83
83
  end
84
84
 
85
85
  event_history
86
- rescue StandardError => e
87
- raise e
86
+ rescue Interrupt, StandardError => e
87
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
88
88
  end
89
89
 
90
90
  # public_class_method def self.cancel_open_order(opts = {})
@@ -104,8 +104,8 @@ module Cryptum
104
104
  # params: params,
105
105
  # order_type: order_type
106
106
  # )
107
- # rescue StandardError => e
108
- # raise e
107
+ # rescue Interrupt, StandardError => e
108
+ # Cryptum::Log.append(level: :error, msg: e, which_self: self)
109
109
  # end
110
110
 
111
111
  public_class_method def self.cancel_all_open_orders(opts = {})
@@ -135,8 +135,8 @@ module Cryptum
135
135
  break if canceled_order_id_arr.empty?
136
136
  end
137
137
  canceled_order_id_arr
138
- rescue StandardError => e
139
- raise e
138
+ rescue Interrupt, StandardError => e
139
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
140
140
  end
141
141
 
142
142
  public_class_method def self.gtfo(opts = {})
@@ -231,8 +231,8 @@ module Cryptum
231
231
  event_history.order_book[:order_history_meta].push(this_order)
232
232
 
233
233
  event_history
234
- rescue StandardError => e
235
- raise e
234
+ rescue Interrupt, StandardError => e
235
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
236
236
  end
237
237
 
238
238
  public_class_method def self.help
@@ -59,8 +59,8 @@ module Cryptum
59
59
  )
60
60
 
61
61
  crypto_portfolio
62
- rescue StandardError => e
63
- raise e
62
+ rescue Interrupt, StandardError => e
63
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
64
64
  end
65
65
 
66
66
  # Display Usage for this Module
@@ -27,8 +27,8 @@ module Cryptum
27
27
  end
28
28
 
29
29
  sorted_products
30
- rescue StandardError => e
31
- raise e
30
+ rescue Interrupt, StandardError => e
31
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
32
32
  end
33
33
 
34
34
  # List Supported Cryptum Products and Exit
@@ -47,8 +47,8 @@ module Cryptum
47
47
  end
48
48
 
49
49
  exit 0
50
- rescue StandardError => e
51
- raise e
50
+ rescue Interrupt, StandardError => e
51
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
52
52
  end
53
53
 
54
54
  # Display Usage for this Module
@@ -116,33 +116,32 @@ module Cryptum
116
116
  )
117
117
 
118
118
  else
119
- File.open('/tmp/cryptum-errors.txt', 'a') do |f|
120
- f.puts "Unsupported HTTP Method #{http_method} for #{self} Plugin"
121
- end
119
+ e = "Unsupported HTTP Method #{http_method}"
120
+ Cryptum::Log.append(level: :debug, msg: e, which_self: self)
122
121
  end
123
122
 
124
123
  resp = JSON.parse(response, symbolize_names: true)
125
124
  resp ||= []
126
125
  rescue RestClient::Unauthorized => e
127
- File.open('/tmp/cryptum-errors.txt', 'a') do |f|
128
- f.puts Time.now.strftime('%Y-%m-%d %H:%M:%S.%N %z')
129
- f.puts "#{self}\n#{e}\n\n\n"
130
- end
126
+ Cryptum::Log.append(level: :debug, msg: e, which_self: self)
131
127
 
132
- raise e if conn_attempt > max_conn_attempts
128
+ if conn_attempt > max_conn_attempts
129
+ Cryptum::Log.append(
130
+ level: :error,
131
+ msg: e,
132
+ which_self: self
133
+ )
134
+ end
133
135
 
134
136
  sleep 60
135
137
  retry
136
138
  end
137
139
  rescue RestClient::ExceptionWithResponse => e
138
- File.open('/tmp/cryptum-errors.txt', 'a') do |f|
139
- f.puts Time.now.strftime('%Y-%m-%d %H:%M:%S.%N %z')
140
- f.puts "Module: #{self}"
141
- f.puts "URL: #{api_endpoint}#{api_call}"
142
- f.puts "PARAMS: #{params.inspect}"
143
- f.puts "HTTP POST BODY: #{http_body.inspect}" if http_body != ''
144
- f.puts "#{e}\n#{e.response}\n\n\n"
145
- end
140
+ debug = "URL: #{api_endpoint}#{api_call}"
141
+ debug += "PARAMS: #{params.inspect}"
142
+ debug += "HTTP POST BODY: #{http_body.inspect}" if http_body != ''
143
+ debug += "#{e}\n#{e.response}\n\n\n"
144
+ Cryptum::Log.append(level: :debug, msg: debug, which_self: self)
146
145
 
147
146
  insufficient_funds = '{"message":"Insufficient funds"}'
148
147
  size -= base_increment if e.response == insufficient_funds
@@ -150,17 +149,16 @@ module Cryptum
150
149
  sleep 0.3
151
150
  retry
152
151
  rescue RestClient::TooManyRequests => e
153
- File.open('/tmp/cryptum-errors.txt', 'a') do |f|
154
- f.puts Time.now.strftime('%Y-%m-%d %H:%M:%S.%N %z')
155
- f.puts "Module: #{self}"
156
- f.puts "URL: #{api_endpoint}#{api_call}"
157
- f.puts "PARAMS: #{params.inspect}"
158
- f.puts "HTTP POST BODY: #{http_body.inspect}" if http_body != ''
159
- f.puts "#{e}\n#{e.response}\n\n\n"
160
- end
152
+ debug = "URL: #{api_endpoint}#{api_call}"
153
+ debug += "PARAMS: #{params.inspect}"
154
+ debug += "HTTP POST BODY: #{http_body.inspect}" if http_body != ''
155
+ debug += "#{e}\n#{e.response}\n\n\n"
156
+ Cryptum::Log.append(level: :debug, msg: debug, which_self: self)
161
157
 
162
158
  sleep 1
163
159
  retry
160
+ rescue Interrupt, StandardError => e
161
+ Cryptum::Log.append(level: error, msg: e, which_self: self)
164
162
  end
165
163
 
166
164
  # Display Usage for this Module
@@ -54,8 +54,8 @@ module Cryptum
54
54
  api_signature_response[:api_signature] = api_signature
55
55
 
56
56
  api_signature_response
57
- rescue StandardError => e
58
- raise e
57
+ rescue Interrupt, StandardError => e
58
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
59
59
  end
60
60
 
61
61
  # Display Usage for this Module
@@ -41,16 +41,9 @@ module Cryptum
41
41
  end
42
42
 
43
43
  retry
44
- rescue Interrupt
45
- # Exit Gracefully if CTRL+C is Pressed During Session
46
- Cryptum::UI::Exit.gracefully(
47
- which_self: self,
48
- event_history: event_history,
49
- option_choice: option_choice
50
- )
51
- rescue StandardError => e
44
+ rescue Interrupt, StandardError => e
52
45
  # Produce a Stacktrace for anything else
53
- raise e
46
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
54
47
  end
55
48
 
56
49
  # SAUCE 1
@@ -147,21 +140,15 @@ module Cryptum
147
140
  end
148
141
 
149
142
  retry
150
- rescue Interrupt
151
- # Exit Gracefully if CTRL+C is Pressed During Session
152
- Cryptum::UI::Exit.gracefully(
153
- which_self: self,
154
- event_history: event_history,
155
- option_choice: option_choice
156
- )
157
- rescue StandardError => e
143
+ rescue Interrupt, StandardError => e
158
144
  # Produce a Stacktrace for anything else
159
- raise e
145
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
160
146
  end
161
147
 
162
148
  # Update Key/Value Pair in Bot Conf and Serialize to YAML File
163
149
  public_class_method def self.update(opts = {})
164
150
  option_choice = opts[:option_choice]
151
+ event_history = opts[:event_history]
165
152
  bot_conf = opts[:bot_conf]
166
153
  key = opts[:key].to_s.to_sym
167
154
  value = opts[:value]
@@ -180,15 +167,9 @@ module Cryptum
180
167
  end
181
168
 
182
169
  retry
183
- rescue Interrupt
184
- # Exit Gracefully if CTRL+C is Pressed During Session
185
- Cryptum::UI::Exit.gracefully(
186
- which_self: self,
187
- option_choice: option_choice
188
- )
189
- rescue StandardError => e
170
+ rescue Interrupt, StandardError => e
190
171
  # Produce a Stacktrace for anything else
191
- raise e
172
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
192
173
  end
193
174
 
194
175
  # Display Usage for this Module
@@ -19,8 +19,8 @@ module Cryptum
19
19
  option_choice: option_choice,
20
20
  event_history: event_history
21
21
  )
22
- rescue StandardError => e
23
- raise e
22
+ rescue Interrupt, StandardError => e
23
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
24
24
  end
25
25
 
26
26
  # Display Usage for this Module
@@ -26,8 +26,8 @@ module Cryptum
26
26
  event_history: event_history,
27
27
  bot_conf: bot_conf
28
28
  )
29
- rescue StandardError => e
30
- raise e
29
+ rescue Interrupt, StandardError => e
30
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
31
31
  end
32
32
 
33
33
  # Display Usage for this Module
@@ -11,17 +11,14 @@ module Cryptum
11
11
  terminal_win = opts[:terminal_win]
12
12
  option_choice = opts[:option_choice]
13
13
  env = opts[:env]
14
- # event_history = opts[:event_history]
15
- # order_type = opts[:order_type]
16
- # order_action = opts[:order_action]
17
14
 
18
15
  terminal_win.key_press_event.key_c = false
19
16
  Cryptum::API::Orders.cancel_all_open_orders(
20
17
  env: env,
21
18
  option_choice: option_choice
22
19
  )
23
- rescue StandardError => e
24
- raise e
20
+ rescue Interrupt, StandardError => e
21
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
25
22
  end
26
23
 
27
24
  # Display Usage for this Module
@@ -11,8 +11,8 @@ module Cryptum
11
11
  event_history = opts[:event_history]
12
12
 
13
13
  Cryptum::UI::Exit.gracefully(event_history: event_history)
14
- rescue StandardError => e
15
- raise e
14
+ rescue Interrupt, StandardError => e
15
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
16
16
  end
17
17
 
18
18
  # Display Usage for this Module
@@ -21,8 +21,8 @@ module Cryptum
21
21
  event_history: event_history,
22
22
  bot_conf: bot_conf
23
23
  )
24
- rescue StandardError => e
25
- raise e
24
+ rescue Interrupt, StandardError => e
25
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
26
26
  end
27
27
 
28
28
  # Display Usage for this Module
@@ -193,15 +193,9 @@ module Cryptum
193
193
  end
194
194
  # -------------------------------------------------- #
195
195
  end
196
- rescue Interrupt
197
- # Exit Gracefully if CTRL+C is Pressed During Session
198
- Cryptum::UI::Exit.gracefully(
199
- which_self: self,
200
- option_choice: option_choice
201
- )
202
- rescue StandardError => e
196
+ rescue Interrupt, StandardError => e
203
197
  # Produce a Stacktrace for anything else
204
- raise e
198
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
205
199
  end
206
200
  end
207
201
  end
@@ -49,8 +49,8 @@ module Cryptum
49
49
  key_press_event: terminal_win.key_press_event,
50
50
  ui_win: terminal_win.command_section
51
51
  )
52
- rescue StandardError => e
53
- raise e
52
+ rescue Interrupt, StandardError => e
53
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
54
54
  end
55
55
 
56
56
  # Display Usage for this Module
@@ -19,8 +19,8 @@ module Cryptum
19
19
  order_book_file,
20
20
  JSON.pretty_generate(event_history.order_book)
21
21
  )
22
- rescue StandardError => e
23
- raise e
22
+ rescue Interrupt, StandardError => e
23
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
24
24
  end
25
25
 
26
26
  # Display Usage for this Module
@@ -21,8 +21,8 @@ module Cryptum
21
21
  event_history.order_plan_win_active = true
22
22
  event_history.order_execute_win_active = false
23
23
  end
24
- rescue StandardError => e
25
- raise e
24
+ rescue Interrupt, StandardError => e
25
+ Cryptum::Log.append(level: :error, msg: e, which_self: self)
26
26
  end
27
27
 
28
28
  # Supported Method Parameters::
@@ -49,8 +49,8 @@ module Cryptum
49
49
  event_history.order_execute_details_win_active = true
50
50
  end
51
51
  end
52
- rescue StandardError => e
53
- raise e
52
+ rescue Interrupt, StandardError => e
53
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
54
54
  end
55
55
 
56
56
  # Display Usage for this Module
@@ -150,16 +150,8 @@ module Cryptum
150
150
  )
151
151
 
152
152
  event_history
153
- rescue Interrupt
154
- # Exit Gracefully if CTRL+C is Pressed During Session
155
- Cryptum::UI::Exit.gracefully(
156
- which_self: self,
157
- event_history: event_history,
158
- option_choice: option_choice,
159
- env: env
160
- )
161
- rescue StandardError => e
162
- raise e
153
+ rescue Interrupt, StandardError => e
154
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
163
155
  end
164
156
 
165
157
  # Display Usage for this Module