cryptum 0.0.380 → 0.0.382
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +3 -8
- data/Gemfile +1 -2
- data/bin/cryptum +3 -3
- data/bin/cryptum-forecast +3 -3
- data/lib/cryptum/api/exchange_rates.rb +42 -0
- data/lib/cryptum/api/fees.rb +36 -0
- data/lib/cryptum/api/order_history.rb +56 -0
- data/lib/cryptum/api/orders.rb +261 -0
- data/lib/cryptum/api/portfolio.rb +79 -0
- data/lib/cryptum/api/products.rb +65 -0
- data/lib/cryptum/api/rest.rb +177 -0
- data/lib/cryptum/api/signature.rb +79 -0
- data/lib/cryptum/api.rb +9 -692
- data/lib/cryptum/bot_conf.rb +14 -3
- data/lib/cryptum/event/buy.rb +1 -1
- data/lib/cryptum/event/cancel.rb +1 -1
- data/lib/cryptum/event/exit.rb +1 -1
- data/lib/cryptum/event/gtfo.rb +1 -1
- data/lib/cryptum/event/history.rb +4 -1
- data/lib/cryptum/event/parse.rb +1 -1
- data/lib/cryptum/event/sell.rb +1 -1
- data/lib/cryptum/option/choice.rb +1 -1
- data/lib/cryptum/order_book/generate.rb +4 -5
- data/lib/cryptum/portfolio/balance.rb +3 -5
- data/lib/cryptum/ui/command.rb +1 -1
- data/lib/cryptum/ui/exit.rb +43 -0
- data/lib/cryptum/ui/key_press_event.rb +1 -1
- data/lib/cryptum/ui/market_trend.rb +4 -1
- data/lib/cryptum/ui/matrix.rb +187 -0
- data/lib/cryptum/ui/order_execute_details.rb +4 -1
- data/lib/cryptum/ui/order_execution.rb +8 -3
- data/lib/cryptum/ui/order_plan.rb +6 -2
- data/lib/cryptum/ui/order_plan_details.rb +4 -1
- data/lib/cryptum/ui/order_timer.rb +5 -1
- data/lib/cryptum/ui/portfolio.rb +5 -1
- data/lib/cryptum/ui/signal_engine.rb +1 -1
- data/lib/cryptum/ui/terminal_window.rb +1 -1
- data/lib/cryptum/ui/ticker.rb +4 -1
- data/lib/cryptum/ui.rb +19 -17
- data/lib/cryptum/version.rb +1 -1
- data/lib/cryptum/web_sock/coinbase.rb +2 -2
- data/lib/cryptum/web_sock/event_machine.rb +1 -1
- data/lib/cryptum.rb +0 -31
- data/spec/lib/cryptum/api/exchange_rates_spec.rb +10 -0
- data/spec/lib/cryptum/api/fees_spec.rb +10 -0
- data/spec/lib/cryptum/api/order_history_spec.rb +10 -0
- data/spec/lib/cryptum/api/orders_spec.rb +10 -0
- data/spec/lib/cryptum/api/portfolio_spec.rb +10 -0
- data/spec/lib/cryptum/api/products_spec.rb +10 -0
- data/spec/lib/cryptum/api/rest_spec.rb +10 -0
- data/spec/lib/cryptum/api/signature_spec.rb +10 -0
- data/spec/lib/cryptum/{matrix_spec.rb → ui/exit_spec.rb} +2 -2
- data/spec/lib/cryptum/ui/matrix_spec.rb +10 -0
- metadata +24 -20
- data/lib/cryptum/matrix.rb +0 -181
data/lib/cryptum/bot_conf.rb
CHANGED
@@ -45,7 +45,11 @@ module Cryptum
|
|
45
45
|
retry
|
46
46
|
rescue Interrupt
|
47
47
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
48
|
-
Cryptum.
|
48
|
+
Cryptum::UI::Exit.gracefully(
|
49
|
+
which_self: self,
|
50
|
+
event_history: event_history,
|
51
|
+
option_choice: option_choice
|
52
|
+
)
|
49
53
|
rescue StandardError => e
|
50
54
|
# Produce a Stacktrace for anything else
|
51
55
|
Curses.close_screen
|
@@ -148,7 +152,11 @@ module Cryptum
|
|
148
152
|
retry
|
149
153
|
rescue Interrupt
|
150
154
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
151
|
-
Cryptum.
|
155
|
+
Cryptum::UI::Exit.gracefully(
|
156
|
+
which_self: self,
|
157
|
+
event_history: event_history,
|
158
|
+
option_choice: option_choice
|
159
|
+
)
|
152
160
|
rescue StandardError => e
|
153
161
|
# Produce a Stacktrace for anything else
|
154
162
|
Curses.close_screen
|
@@ -178,7 +186,10 @@ module Cryptum
|
|
178
186
|
retry
|
179
187
|
rescue Interrupt
|
180
188
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
181
|
-
Cryptum.
|
189
|
+
Cryptum::UI::Exit.gracefully(
|
190
|
+
which_self: self,
|
191
|
+
option_choice: option_choice
|
192
|
+
)
|
182
193
|
rescue StandardError => e
|
183
194
|
# Produce a Stacktrace for anything else
|
184
195
|
Curses.close_screen
|
data/lib/cryptum/event/buy.rb
CHANGED
@@ -117,7 +117,7 @@ module Cryptum
|
|
117
117
|
event_history.order_submitted = true
|
118
118
|
event_history.event_notes = "{ \"event_type\": \"#{event_history.event_type}\", \"cancel\": \"#{event_history.order_canceled}\", \"submitted\": \"#{event_history.order_submitted}\" }" if option_choice.proxy
|
119
119
|
|
120
|
-
event_history = Cryptum::API.submit_limit_order(
|
120
|
+
event_history = Cryptum::API::Orders.submit_limit_order(
|
121
121
|
option_choice: option_choice,
|
122
122
|
env: env,
|
123
123
|
price: price,
|
data/lib/cryptum/event/cancel.rb
CHANGED
data/lib/cryptum/event/exit.rb
CHANGED
data/lib/cryptum/event/gtfo.rb
CHANGED
@@ -195,7 +195,10 @@ module Cryptum
|
|
195
195
|
end
|
196
196
|
rescue Interrupt
|
197
197
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
198
|
-
Cryptum.
|
198
|
+
Cryptum::UI::Exit.gracefully(
|
199
|
+
which_self: self,
|
200
|
+
option_choice: option_choice
|
201
|
+
)
|
199
202
|
rescue StandardError => e
|
200
203
|
# Produce a Stacktrace for anything else
|
201
204
|
raise e
|
data/lib/cryptum/event/parse.rb
CHANGED
@@ -152,7 +152,7 @@ module Cryptum
|
|
152
152
|
event_history
|
153
153
|
rescue Interrupt
|
154
154
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
155
|
-
Cryptum.
|
155
|
+
Cryptum::UI::Exit.gracefully(
|
156
156
|
which_self: self,
|
157
157
|
event_history: event_history,
|
158
158
|
option_choice: option_choice,
|
data/lib/cryptum/event/sell.rb
CHANGED
@@ -96,7 +96,7 @@ module Cryptum
|
|
96
96
|
event_history.order_submitted = true
|
97
97
|
event_history.event_notes = "{ \"event_type\": \"#{event_history.event_type}\", \"cancel\": \"#{event_history.order_canceled}\", \"submitted\": \"#{event_history.order_submitted}\" }" if option_choice.proxy
|
98
98
|
|
99
|
-
event_history = Cryptum::API.submit_limit_order(
|
99
|
+
event_history = Cryptum::API::Orders.submit_limit_order(
|
100
100
|
option_choice: option_choice,
|
101
101
|
env: env,
|
102
102
|
price: price,
|
@@ -18,7 +18,7 @@ module Cryptum
|
|
18
18
|
|
19
19
|
rescue Interrupt
|
20
20
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
21
|
-
Cryptum.
|
21
|
+
Cryptum::UI::Exit.gracefully(which_self: self)
|
22
22
|
rescue StandardError => e
|
23
23
|
# Produce a Stacktrace for anything else
|
24
24
|
Curses.close_screen
|
@@ -3,19 +3,18 @@
|
|
3
3
|
require 'io/console'
|
4
4
|
require 'json'
|
5
5
|
require 'logger'
|
6
|
-
require 'tty-spinner'
|
7
6
|
|
8
7
|
module Cryptum
|
9
8
|
# This module is used to define the Order Book Data Structure
|
10
9
|
module OrderBook
|
11
10
|
module Generate
|
12
11
|
# Supported Method Parameters::
|
13
|
-
# Cryptum::OrderBook.
|
12
|
+
# Cryptum::OrderBook::Generate.new(
|
14
13
|
# symbol: 'required - target symbol (e.g. btc-usd)',
|
15
14
|
# this_product: 'required - this_product',
|
16
15
|
# )
|
17
16
|
|
18
|
-
public_class_method def self.
|
17
|
+
public_class_method def self.new(opts = {})
|
19
18
|
start_time = opts[:start_time]
|
20
19
|
option_choice = opts[:option_choice]
|
21
20
|
env = opts[:env]
|
@@ -25,7 +24,7 @@ module Cryptum
|
|
25
24
|
order_book_file = "#{session_root}/order_books/#{symbol}.ORDER_BOOK.json"
|
26
25
|
|
27
26
|
# Only need to retrieve a product list once / session.
|
28
|
-
products = Cryptum::API.
|
27
|
+
products = Cryptum::API::Products.get(
|
29
28
|
option_choice: option_choice,
|
30
29
|
env: env
|
31
30
|
)
|
@@ -103,7 +102,7 @@ module Cryptum
|
|
103
102
|
|
104
103
|
public_class_method def self.help
|
105
104
|
puts "USAGE:
|
106
|
-
order_book = #{self}.
|
105
|
+
order_book = #{self}.new(
|
107
106
|
symbol: 'required - target symbol (e.g. btc-usd)',
|
108
107
|
this_product: 'required - this_product'
|
109
108
|
)
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'logger'
|
4
|
-
|
5
3
|
module Cryptum
|
6
4
|
# This plugin is used to instantiate a Cryptum logger with a custom message format
|
7
5
|
module Portfolio
|
@@ -64,7 +62,7 @@ module Cryptum
|
|
64
62
|
enotes = "{ \"event_type\": \"#{etype}\", \"cancel\": \"#{ocancel}\", \"submitted\": \"#{osubmit}\" }" if option_choice.proxy
|
65
63
|
event_history.event_notes = enotes
|
66
64
|
|
67
|
-
portfolio = Cryptum::API.
|
65
|
+
portfolio = Cryptum::API::Portfolio.get(
|
68
66
|
option_choice: option_choice,
|
69
67
|
env: env,
|
70
68
|
crypto: crypto,
|
@@ -74,13 +72,13 @@ module Cryptum
|
|
74
72
|
)
|
75
73
|
event_history.order_book[:portfolio] = portfolio unless portfolio.empty?
|
76
74
|
|
77
|
-
order_history = Cryptum::API.
|
75
|
+
order_history = Cryptum::API::OrderHistory.get(
|
78
76
|
option_choice: option_choice,
|
79
77
|
env: env
|
80
78
|
)
|
81
79
|
event_history.order_book[:order_history] = order_history unless order_history.empty?
|
82
80
|
|
83
|
-
fees = Cryptum::API.
|
81
|
+
fees = Cryptum::API::Fees.get(
|
84
82
|
option_choice: option_choice,
|
85
83
|
env: env
|
86
84
|
)
|
data/lib/cryptum/ui/command.rb
CHANGED
@@ -295,7 +295,7 @@ module Cryptum
|
|
295
295
|
key_press_event.key_x
|
296
296
|
rescue Interrupt
|
297
297
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
298
|
-
Cryptum.
|
298
|
+
Cryptum::UI::Exit.gracefully(which_self: self)
|
299
299
|
rescue StandardError => e
|
300
300
|
raise e
|
301
301
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cryptum
|
4
|
+
module UI
|
5
|
+
# This Class is Used to Detect Key Press Events
|
6
|
+
module Exit
|
7
|
+
public_class_method def self.gracefully(opts = {})
|
8
|
+
which_self = opts[:which_self]
|
9
|
+
event_history = opts[:event_history]
|
10
|
+
# option_choice = opts[:option_choice]
|
11
|
+
# env = opts[:env]
|
12
|
+
|
13
|
+
# Clear out candle data to ensure
|
14
|
+
# Cryptum Statistics Only Apply to
|
15
|
+
# Live Sessions
|
16
|
+
if event_history
|
17
|
+
File.write(
|
18
|
+
order_book_file,
|
19
|
+
JSON.pretty_generate(event_history.order_book)
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
Curses.close_screen
|
24
|
+
puts "Interrupt detected in #{which_self}...goodbye."
|
25
|
+
|
26
|
+
exit 0
|
27
|
+
rescue NameError
|
28
|
+
puts "\nInterrupt detected in #{which_self}...goodbye."
|
29
|
+
|
30
|
+
exit 0
|
31
|
+
rescue StandardError => e
|
32
|
+
# Produce a Stacktrace for anything else
|
33
|
+
raise e
|
34
|
+
end
|
35
|
+
|
36
|
+
# Display a List of Every UI Module
|
37
|
+
|
38
|
+
public_class_method def self.help
|
39
|
+
constants.sort
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -23,7 +23,7 @@ module Cryptum
|
|
23
23
|
|
24
24
|
rescue Interrupt
|
25
25
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
26
|
-
Cryptum.
|
26
|
+
Cryptum::UI::Exit.gracefully(which_self: self)
|
27
27
|
rescue StandardError => e
|
28
28
|
# Produce a Stacktrace for anything else
|
29
29
|
Curses.close_screen
|
@@ -57,7 +57,10 @@ module Cryptum
|
|
57
57
|
event_history
|
58
58
|
rescue Interrupt
|
59
59
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
60
|
-
Cryptum.
|
60
|
+
Cryptum::UI::Exit.gracefully(
|
61
|
+
which_self: self,
|
62
|
+
event_history: event_history
|
63
|
+
)
|
61
64
|
rescue StandardError => e
|
62
65
|
raise e
|
63
66
|
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
module Cryptum
|
6
|
+
# This plugin is used to Refresh the Cryptum console UI
|
7
|
+
module UI
|
8
|
+
# This plugin is used as a visual representation of being in a, "Red Pill" state
|
9
|
+
module Matrix
|
10
|
+
# Supported Method Parameters::
|
11
|
+
# Cryptum::Matrix.generate(
|
12
|
+
# cols: cols
|
13
|
+
# )
|
14
|
+
|
15
|
+
public_class_method def self.generate(opts = {})
|
16
|
+
# Need to divide by two for wide characters
|
17
|
+
cols = opts[:cols].to_i
|
18
|
+
|
19
|
+
matrix_arr = [
|
20
|
+
0x30a0.chr('UTF-8'),
|
21
|
+
0x30a1.chr('UTF-8'),
|
22
|
+
0x30a2.chr('UTF-8'),
|
23
|
+
0x30a3.chr('UTF-8'),
|
24
|
+
0x30a4.chr('UTF-8'),
|
25
|
+
0x30a5.chr('UTF-8'),
|
26
|
+
0x30a6.chr('UTF-8'),
|
27
|
+
0x30a7.chr('UTF-8'),
|
28
|
+
0x30a8.chr('UTF-8'),
|
29
|
+
0x30a9.chr('UTF-8'),
|
30
|
+
0x30aa.chr('UTF-8'),
|
31
|
+
0x30ab.chr('UTF-8'),
|
32
|
+
0x30ac.chr('UTF-8'),
|
33
|
+
0x30ad.chr('UTF-8'),
|
34
|
+
0x30ae.chr('UTF-8'),
|
35
|
+
0x30af.chr('UTF-8'),
|
36
|
+
0x30b0.chr('UTF-8'),
|
37
|
+
0x30b1.chr('UTF-8'),
|
38
|
+
0x30b2.chr('UTF-8'),
|
39
|
+
0x30b3.chr('UTF-8'),
|
40
|
+
0x30b4.chr('UTF-8'),
|
41
|
+
0x30b5.chr('UTF-8'),
|
42
|
+
0x30b6.chr('UTF-8'),
|
43
|
+
0x30b7.chr('UTF-8'),
|
44
|
+
0x30b8.chr('UTF-8'),
|
45
|
+
0x30b9.chr('UTF-8'),
|
46
|
+
0x30ba.chr('UTF-8'),
|
47
|
+
0x30bb.chr('UTF-8'),
|
48
|
+
0x30bc.chr('UTF-8'),
|
49
|
+
0x30bd.chr('UTF-8'),
|
50
|
+
0x30be.chr('UTF-8'),
|
51
|
+
0x30bf.chr('UTF-8'),
|
52
|
+
0x30c0.chr('UTF-8'),
|
53
|
+
0x30c1.chr('UTF-8'),
|
54
|
+
0x30c2.chr('UTF-8'),
|
55
|
+
0x30c3.chr('UTF-8'),
|
56
|
+
0x30c4.chr('UTF-8'),
|
57
|
+
0x30c5.chr('UTF-8'),
|
58
|
+
0x30c6.chr('UTF-8'),
|
59
|
+
0x30c7.chr('UTF-8'),
|
60
|
+
0x30c8.chr('UTF-8'),
|
61
|
+
0x30c9.chr('UTF-8'),
|
62
|
+
0x30ca.chr('UTF-8'),
|
63
|
+
0x30cb.chr('UTF-8'),
|
64
|
+
0x30cc.chr('UTF-8'),
|
65
|
+
0x30cd.chr('UTF-8'),
|
66
|
+
0x30ce.chr('UTF-8'),
|
67
|
+
0x30cf.chr('UTF-8'),
|
68
|
+
0x30d0.chr('UTF-8'),
|
69
|
+
0x30d1.chr('UTF-8'),
|
70
|
+
0x30d2.chr('UTF-8'),
|
71
|
+
0x30d3.chr('UTF-8'),
|
72
|
+
0x30d4.chr('UTF-8'),
|
73
|
+
0x30d5.chr('UTF-8'),
|
74
|
+
0x30d6.chr('UTF-8'),
|
75
|
+
0x30d7.chr('UTF-8'),
|
76
|
+
0x30d8.chr('UTF-8'),
|
77
|
+
0x30d9.chr('UTF-8'),
|
78
|
+
0x30da.chr('UTF-8'),
|
79
|
+
0x30db.chr('UTF-8'),
|
80
|
+
0x30dc.chr('UTF-8'),
|
81
|
+
0x30dd.chr('UTF-8'),
|
82
|
+
0x30de.chr('UTF-8'),
|
83
|
+
0x30df.chr('UTF-8'),
|
84
|
+
0x30e0.chr('UTF-8'),
|
85
|
+
0x30e1.chr('UTF-8'),
|
86
|
+
0x30e2.chr('UTF-8'),
|
87
|
+
0x30e3.chr('UTF-8'),
|
88
|
+
0x30e4.chr('UTF-8'),
|
89
|
+
0x30e5.chr('UTF-8'),
|
90
|
+
0x30e6.chr('UTF-8'),
|
91
|
+
0x30e7.chr('UTF-8'),
|
92
|
+
0x30e8.chr('UTF-8'),
|
93
|
+
0x30e9.chr('UTF-8'),
|
94
|
+
0x30ea.chr('UTF-8'),
|
95
|
+
0x30eb.chr('UTF-8'),
|
96
|
+
0x30ec.chr('UTF-8'),
|
97
|
+
0x30ed.chr('UTF-8'),
|
98
|
+
0x30ee.chr('UTF-8'),
|
99
|
+
0x30ef.chr('UTF-8'),
|
100
|
+
0x30f0.chr('UTF-8'),
|
101
|
+
0x30f1.chr('UTF-8'),
|
102
|
+
0x30f2.chr('UTF-8'),
|
103
|
+
0x30f3.chr('UTF-8'),
|
104
|
+
0x30f4.chr('UTF-8'),
|
105
|
+
0x30f5.chr('UTF-8'),
|
106
|
+
0x30f6.chr('UTF-8'),
|
107
|
+
0x30f7.chr('UTF-8'),
|
108
|
+
0x30f8.chr('UTF-8'),
|
109
|
+
0x30f9.chr('UTF-8'),
|
110
|
+
0x30fa.chr('UTF-8'),
|
111
|
+
0x30fb.chr('UTF-8'),
|
112
|
+
0x30fc.chr('UTF-8'),
|
113
|
+
0x30fd.chr('UTF-8'),
|
114
|
+
0x30fe.chr('UTF-8'),
|
115
|
+
'0 ',
|
116
|
+
'1 ',
|
117
|
+
'2 ',
|
118
|
+
'3 ',
|
119
|
+
'4 ',
|
120
|
+
'5 ',
|
121
|
+
'6 ',
|
122
|
+
'7 ',
|
123
|
+
'8 ',
|
124
|
+
'9 ',
|
125
|
+
'A ',
|
126
|
+
'c ',
|
127
|
+
'R ',
|
128
|
+
'y ',
|
129
|
+
'P ',
|
130
|
+
't ',
|
131
|
+
'U ',
|
132
|
+
'm ',
|
133
|
+
'x ',
|
134
|
+
'Z ',
|
135
|
+
': ',
|
136
|
+
'{ ',
|
137
|
+
'[ ',
|
138
|
+
'} ',
|
139
|
+
'] ',
|
140
|
+
'| ',
|
141
|
+
'` ',
|
142
|
+
'~ ',
|
143
|
+
'! ',
|
144
|
+
'@ ',
|
145
|
+
'# ',
|
146
|
+
'$ ',
|
147
|
+
'% ',
|
148
|
+
'^ ',
|
149
|
+
'& ',
|
150
|
+
'* ',
|
151
|
+
'( ',
|
152
|
+
') ',
|
153
|
+
'_ ',
|
154
|
+
'- ',
|
155
|
+
'= ',
|
156
|
+
'+ ',
|
157
|
+
'> ',
|
158
|
+
'< ',
|
159
|
+
'. ',
|
160
|
+
', '
|
161
|
+
]
|
162
|
+
|
163
|
+
last_index = matrix_arr.length - 1
|
164
|
+
|
165
|
+
matrix_row = ''
|
166
|
+
most_cols = cols - 1
|
167
|
+
most_cols.times.each do
|
168
|
+
matrix_row += "#{matrix_arr[Random.rand(0..last_index)]} "
|
169
|
+
end
|
170
|
+
matrix_row += matrix_arr[Random.rand(0..last_index)]
|
171
|
+
rescue Interrupt
|
172
|
+
# Exit Gracefully if CTRL+C is Pressed During Session
|
173
|
+
Cryptum::UI::Exit.gracefully(which_self: self)
|
174
|
+
rescue StandardError => e
|
175
|
+
raise e
|
176
|
+
end
|
177
|
+
|
178
|
+
# Display Usage for this Module
|
179
|
+
|
180
|
+
public_class_method def self.help
|
181
|
+
puts "USAGE:
|
182
|
+
matrix_row = #{self}.generate(cols: Curses.cols)
|
183
|
+
"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
@@ -279,7 +279,10 @@ module Cryptum
|
|
279
279
|
event_history
|
280
280
|
rescue Interrupt
|
281
281
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
282
|
-
Cryptum.
|
282
|
+
Cryptum::UI::Exit.gracefully(
|
283
|
+
which_self: self,
|
284
|
+
event_history: event_history
|
285
|
+
)
|
283
286
|
rescue StandardError => e
|
284
287
|
raise e
|
285
288
|
end
|
@@ -127,7 +127,7 @@ module Cryptum
|
|
127
127
|
event_history.red_pill = true if fiat_invested_this_order > fiat_avail_to_trade.to_f
|
128
128
|
|
129
129
|
unless event_history.red_pill
|
130
|
-
event_history = Cryptum::API.submit_limit_order(
|
130
|
+
event_history = Cryptum::API::Orders.submit_limit_order(
|
131
131
|
option_choice: option_choice,
|
132
132
|
env: env,
|
133
133
|
price: price,
|
@@ -253,7 +253,7 @@ module Cryptum
|
|
253
253
|
|
254
254
|
size = order_ready_to_sell[:size]
|
255
255
|
|
256
|
-
Cryptum::API.submit_limit_order(
|
256
|
+
Cryptum::API::Orders.submit_limit_order(
|
257
257
|
option_choice: option_choice,
|
258
258
|
env: env,
|
259
259
|
price: price,
|
@@ -604,7 +604,12 @@ module Cryptum
|
|
604
604
|
event_history
|
605
605
|
rescue Interrupt
|
606
606
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
607
|
-
Cryptum.
|
607
|
+
Cryptum::UI::Exit.gracefully(
|
608
|
+
which_self: self,
|
609
|
+
event_history: event_history,
|
610
|
+
option_choice: option_choice,
|
611
|
+
env: env
|
612
|
+
)
|
608
613
|
rescue StandardError => e
|
609
614
|
raise e
|
610
615
|
end
|
@@ -334,7 +334,7 @@ module Cryptum
|
|
334
334
|
|
335
335
|
max_rows_to_display.times.each do
|
336
336
|
out_line_no += 1
|
337
|
-
this_matrix_row = Cryptum::Matrix.generate(cols: Curses.cols)
|
337
|
+
this_matrix_row = Cryptum::UI::Matrix.generate(cols: Curses.cols)
|
338
338
|
order_plan_win.setpos(out_line_no, Cryptum::UI.col_first)
|
339
339
|
order_plan_win.clrtoeol
|
340
340
|
Cryptum::UI.colorize(
|
@@ -494,7 +494,11 @@ module Cryptum
|
|
494
494
|
event_history
|
495
495
|
rescue Interrupt
|
496
496
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
497
|
-
Cryptum.
|
497
|
+
Cryptum::UI::Exit.gracefully(
|
498
|
+
which_self: self,
|
499
|
+
event_history: event_history,
|
500
|
+
option_choice: option_choice
|
501
|
+
)
|
498
502
|
rescue StandardError => e
|
499
503
|
raise e
|
500
504
|
end
|
@@ -222,7 +222,10 @@ module Cryptum
|
|
222
222
|
event_history
|
223
223
|
rescue Interrupt
|
224
224
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
225
|
-
Cryptum.
|
225
|
+
Cryptum::UI::Exit.gracefully(
|
226
|
+
which_self: self,
|
227
|
+
event_history: event_history
|
228
|
+
)
|
226
229
|
rescue StandardError => e
|
227
230
|
raise e
|
228
231
|
end
|
@@ -118,7 +118,11 @@ module Cryptum
|
|
118
118
|
order_countdown.to_f
|
119
119
|
rescue Interrupt
|
120
120
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
121
|
-
Cryptum.
|
121
|
+
Cryptum::UI::Exit.gracefully(
|
122
|
+
which_self: self,
|
123
|
+
event_history: event_history,
|
124
|
+
option_choice: option_choice
|
125
|
+
)
|
122
126
|
rescue StandardError => e
|
123
127
|
raise e
|
124
128
|
end
|
data/lib/cryptum/ui/portfolio.rb
CHANGED
@@ -201,7 +201,11 @@ module Cryptum
|
|
201
201
|
event_history
|
202
202
|
rescue Interrupt
|
203
203
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
204
|
-
Cryptum.
|
204
|
+
Cryptum::UI::Exit.gracefully(
|
205
|
+
which_self: self,
|
206
|
+
event_history: event_history,
|
207
|
+
option_choice: option_choice
|
208
|
+
)
|
205
209
|
rescue StandardError => e
|
206
210
|
raise e
|
207
211
|
end
|
@@ -101,7 +101,7 @@ module Cryptum
|
|
101
101
|
end
|
102
102
|
rescue Interrupt
|
103
103
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
104
|
-
Cryptum.
|
104
|
+
Cryptum::UI::Exit.gracefully(which_self: self)
|
105
105
|
rescue StandardError => e
|
106
106
|
# Produce a Stacktrace for anything else
|
107
107
|
Curses.close_screen
|
data/lib/cryptum/ui/ticker.rb
CHANGED
@@ -299,7 +299,10 @@ module Cryptum
|
|
299
299
|
event_history
|
300
300
|
rescue Interrupt
|
301
301
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
302
|
-
Cryptum.
|
302
|
+
Cryptum::UI::Exit.gracefully(
|
303
|
+
which_self: self,
|
304
|
+
event_history: event_history
|
305
|
+
)
|
303
306
|
rescue StandardError => e
|
304
307
|
raise e
|
305
308
|
end
|