cryptum 0.0.385 → 0.0.387

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +13 -4
  3. data/Gemfile +1 -1
  4. data/README.md +2 -2
  5. data/bin/cryptum +48 -61
  6. data/git_commit.sh +1 -0
  7. data/lib/cryptum/api/exchange_rates.rb +2 -2
  8. data/lib/cryptum/api/fees.rb +2 -2
  9. data/lib/cryptum/api/order_history.rb +2 -2
  10. data/lib/cryptum/api/orders.rb +8 -8
  11. data/lib/cryptum/api/portfolio.rb +2 -2
  12. data/lib/cryptum/api/products.rb +4 -4
  13. data/lib/cryptum/api/rest.rb +22 -24
  14. data/lib/cryptum/api/signature.rb +2 -2
  15. data/lib/cryptum/bot_conf.rb +7 -29
  16. data/lib/cryptum/event/bot_conf.rb +2 -2
  17. data/lib/cryptum/event/buy.rb +2 -2
  18. data/lib/cryptum/event/cancel.rb +2 -5
  19. data/lib/cryptum/event/exit.rb +3 -12
  20. data/lib/cryptum/event/gtfo.rb +2 -2
  21. data/lib/cryptum/event/history.rb +2 -8
  22. data/lib/cryptum/event/key_press.rb +2 -2
  23. data/lib/cryptum/event/order_book.rb +2 -2
  24. data/lib/cryptum/event/pane.rb +4 -4
  25. data/lib/cryptum/event/parse.rb +2 -10
  26. data/lib/cryptum/event/scroll.rb +12 -12
  27. data/lib/cryptum/event/sell.rb +2 -2
  28. data/lib/cryptum/log.rb +31 -11
  29. data/lib/cryptum/open_ai.rb +10 -9
  30. data/lib/cryptum/option/choice.rb +2 -6
  31. data/lib/cryptum/option/environment.rb +2 -2
  32. data/lib/cryptum/option/input_validation.rb +2 -2
  33. data/lib/cryptum/option/parser.rb +2 -2
  34. data/lib/cryptum/order_book/generate.rb +2 -2
  35. data/lib/cryptum/order_book/market_trend.rb +4 -15
  36. data/lib/cryptum/order_book/profit_margin.rb +2 -2
  37. data/lib/cryptum/portfolio/balance.rb +2 -2
  38. data/lib/cryptum/ui/command.rb +2 -5
  39. data/lib/cryptum/ui/exit.rb +9 -18
  40. data/lib/cryptum/ui/key_press_event.rb +2 -6
  41. data/lib/cryptum/ui/market_trend.rb +2 -8
  42. data/lib/cryptum/ui/matrix.rb +2 -5
  43. data/lib/cryptum/ui/order/execute.rb +2 -10
  44. data/lib/cryptum/ui/order/execute_details.rb +2 -8
  45. data/lib/cryptum/ui/order/plan.rb +11 -10
  46. data/lib/cryptum/ui/order/plan_details.rb +2 -8
  47. data/lib/cryptum/ui/order/timer.rb +2 -9
  48. data/lib/cryptum/ui/portfolio.rb +6 -10
  49. data/lib/cryptum/ui/signal_engine.rb +2 -5
  50. data/lib/cryptum/ui/terminal_window.rb +2 -6
  51. data/lib/cryptum/ui/ticker.rb +2 -8
  52. data/lib/cryptum/ui.rb +24 -61
  53. data/lib/cryptum/version.rb +1 -1
  54. data/lib/cryptum/web_sock/coinbase.rb +4 -7
  55. data/lib/cryptum/web_sock/event_machine.rb +15 -24
  56. data/lib/cryptum.rb +20 -7
  57. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 458a0c463a08f598e1694034fbf077f46a8ba8b263c408fd574b35211c40a69b
4
- data.tar.gz: 8b8bf8cf3ff0cd9dfa1ebb3609ad50e6f05d09aea705e726b840060e58d39c32
3
+ metadata.gz: 0e9169a592ad25d86eeb7b4d34576223135b1e8fda2ad3ec7736761abcfef378
4
+ data.tar.gz: 6bdec8afaac4ca9664aa84a5c353c2d4e0c6a2f86bbce355ca472b5addde18bc
5
5
  SHA512:
6
- metadata.gz: 3963c369c745590402ff8943487eb057541b6eae6278cf67992981cbdb0919c847207fcfb43cac8b3cf991b5c1c866adc57035e6106a5715ed7f439ab4e92a8a
7
- data.tar.gz: d6abdb55f67bab96545d5207c9d4e995edcbec9d9a85d49b13e01a4a2d4522c5e9b20529460f1b2e20a10dad7f3dc2edfc78376215f85888b2278f5d0131582f
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/Gemfile CHANGED
@@ -26,7 +26,7 @@ gem 'rdoc', '6.5.0'
26
26
  gem 'require_all', '3.0.0'
27
27
  gem 'rest-client', '2.1.0'
28
28
  gem 'rspec', '3.12.0'
29
- gem 'rubocop', '1.48.1'
29
+ gem 'rubocop', '1.49.0'
30
30
  gem 'rubocop-rake', '0.6.0'
31
31
  gem 'rubocop-rspec', '2.19.0'
32
32
  gem 'ruby-prof', '1.6.1'
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,70 +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
- Cryptum::UI::Exit.gracefully(
65
- which_self: self,
66
- event_history: event_history,
67
- option_choice: option_choice,
68
- env: env
69
- )
70
- rescue StandardError => e
71
- # Produce a Stacktrace for anything else
72
- raise e
73
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,17 +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
- Curses.close_screen
54
- raise e
46
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
55
47
  end
56
48
 
57
49
  # SAUCE 1
@@ -148,22 +140,15 @@ module Cryptum
148
140
  end
149
141
 
150
142
  retry
151
- rescue Interrupt
152
- # Exit Gracefully if CTRL+C is Pressed During Session
153
- Cryptum::UI::Exit.gracefully(
154
- which_self: self,
155
- event_history: event_history,
156
- option_choice: option_choice
157
- )
158
- rescue StandardError => e
143
+ rescue Interrupt, StandardError => e
159
144
  # Produce a Stacktrace for anything else
160
- Curses.close_screen
161
- raise e
145
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
162
146
  end
163
147
 
164
148
  # Update Key/Value Pair in Bot Conf and Serialize to YAML File
165
149
  public_class_method def self.update(opts = {})
166
150
  option_choice = opts[:option_choice]
151
+ event_history = opts[:event_history]
167
152
  bot_conf = opts[:bot_conf]
168
153
  key = opts[:key].to_s.to_sym
169
154
  value = opts[:value]
@@ -182,16 +167,9 @@ module Cryptum
182
167
  end
183
168
 
184
169
  retry
185
- rescue Interrupt
186
- # Exit Gracefully if CTRL+C is Pressed During Session
187
- Cryptum::UI::Exit.gracefully(
188
- which_self: self,
189
- option_choice: option_choice
190
- )
191
- rescue StandardError => e
170
+ rescue Interrupt, StandardError => e
192
171
  # Produce a Stacktrace for anything else
193
- Curses.close_screen
194
- raise e
172
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
195
173
  end
196
174
 
197
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
@@ -8,20 +8,11 @@ module Cryptum
8
8
  # Cryptum::Event::Exit.gracefully(
9
9
  # )
10
10
  public_class_method def self.gracefully(opts = {})
11
- terminal_win = opts[:terminal_win]
12
11
  event_history = opts[:event_history]
13
- option_choice = opts[:option_choice]
14
- env = opts[:env]
15
12
 
16
- terminal_win.key_press_event.key_x = false
17
- Cryptum::UI::Exit.gracefully(
18
- which_self: self,
19
- event_history: event_history,
20
- option_choice: option_choice,
21
- env: env
22
- )
23
- rescue StandardError => e
24
- raise e
13
+ Cryptum::UI::Exit.gracefully(event_history: event_history)
14
+ rescue Interrupt, StandardError => e
15
+ Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
25
16
  end
26
17
 
27
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