cryptum 0.0.381 → 0.0.383
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 +11 -8
- data/Gemfile +1 -2
- data/bin/cryptum +2 -2
- data/lib/cryptum/api/exchange_rates.rb +0 -2
- data/lib/cryptum/api/orders.rb +9 -7
- data/lib/cryptum/api/portfolio.rb +0 -2
- data/lib/cryptum/api/rest.rb +3 -4
- data/lib/cryptum/api/signature.rb +0 -4
- data/lib/cryptum/api.rb +1 -40
- data/lib/cryptum/bot_conf.rb +14 -6
- data/lib/cryptum/event/exit.rb +1 -1
- data/lib/cryptum/event/history.rb +4 -1
- data/lib/cryptum/event/parse.rb +6 -6
- data/lib/cryptum/event.rb +0 -2
- data/lib/cryptum/log.rb +18 -4
- data/lib/cryptum/open_ai.rb +129 -32
- data/lib/cryptum/option/choice.rb +1 -1
- data/lib/cryptum/option/environment.rb +0 -2
- data/lib/cryptum/option/parser.rb +0 -2
- data/lib/cryptum/order_book/generate.rb +3 -8
- data/lib/cryptum/order_book.rb +0 -3
- data/lib/cryptum/portfolio.rb +0 -2
- data/lib/cryptum/ui/command.rb +1 -3
- 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 -3
- data/lib/cryptum/ui/matrix.rb +185 -0
- data/lib/cryptum/ui/order/execute.rb +629 -0
- data/lib/cryptum/ui/order/execute_details.rb +300 -0
- data/lib/cryptum/ui/order/plan.rb +518 -0
- data/lib/cryptum/ui/order/plan_details.rb +243 -0
- data/lib/cryptum/ui/order/timer.rb +140 -0
- data/lib/cryptum/ui/order.rb +21 -0
- data/lib/cryptum/ui/portfolio.rb +5 -3
- data/lib/cryptum/ui/signal_engine.rb +1 -3
- data/lib/cryptum/ui/terminal_window.rb +1 -3
- data/lib/cryptum/ui/ticker.rb +4 -3
- data/lib/cryptum/ui.rb +17 -22
- data/lib/cryptum/version.rb +1 -1
- data/lib/cryptum/web_sock/coinbase.rb +1 -6
- data/lib/cryptum/web_sock/event_machine.rb +3 -7
- data/lib/cryptum.rb +16 -33
- data/spec/lib/cryptum/{matrix_spec.rb → ui/exit_spec.rb} +2 -2
- data/spec/lib/cryptum/ui/{order_plan_spec.rb → matrix_spec.rb} +2 -2
- data/spec/lib/cryptum/ui/{order_execute_details_spec.rb → order/execute_details_spec.rb} +2 -2
- data/spec/lib/cryptum/ui/{order_execution_spec.rb → order/execute_spec.rb} +2 -2
- data/spec/lib/cryptum/ui/{order_plan_details_spec.rb → order/plan_details_spec.rb} +2 -2
- data/spec/lib/cryptum/ui/order/plan_spec.rb +10 -0
- data/spec/lib/cryptum/ui/order/timer_spec.rb +10 -0
- data/spec/lib/cryptum/ui/{order_timer_spec.rb → order_spec.rb} +2 -2
- metadata +20 -30
- data/lib/cryptum/matrix.rb +0 -181
- data/lib/cryptum/ui/order_execute_details.rb +0 -297
- data/lib/cryptum/ui/order_execution.rb +0 -624
- data/lib/cryptum/ui/order_plan.rb +0 -514
- data/lib/cryptum/ui/order_plan_details.rb +0 -240
- data/lib/cryptum/ui/order_timer.rb +0 -136
data/lib/cryptum/order_book.rb
CHANGED
data/lib/cryptum/portfolio.rb
CHANGED
data/lib/cryptum/ui/command.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'logger'
|
4
|
-
|
5
3
|
module Cryptum
|
6
4
|
module UI
|
7
5
|
# This plugin is used to Refresh the Cryptum Command Section UI
|
@@ -295,7 +293,7 @@ module Cryptum
|
|
295
293
|
key_press_event.key_x
|
296
294
|
rescue Interrupt
|
297
295
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
298
|
-
Cryptum.
|
296
|
+
Cryptum::UI::Exit.gracefully(which_self: self)
|
299
297
|
rescue StandardError => e
|
300
298
|
raise e
|
301
299
|
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
|
@@ -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 Refresh the Cryptum console UI
|
7
5
|
module UI
|
@@ -57,7 +55,10 @@ module Cryptum
|
|
57
55
|
event_history
|
58
56
|
rescue Interrupt
|
59
57
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
60
|
-
Cryptum.
|
58
|
+
Cryptum::UI::Exit.gracefully(
|
59
|
+
which_self: self,
|
60
|
+
event_history: event_history
|
61
|
+
)
|
61
62
|
rescue StandardError => e
|
62
63
|
raise e
|
63
64
|
end
|
@@ -0,0 +1,185 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cryptum
|
4
|
+
# This plugin is used to Refresh the Cryptum console UI
|
5
|
+
module UI
|
6
|
+
# This plugin is used as a visual representation of being in a, "Red Pill" state
|
7
|
+
module Matrix
|
8
|
+
# Supported Method Parameters::
|
9
|
+
# Cryptum::Matrix.generate(
|
10
|
+
# cols: cols
|
11
|
+
# )
|
12
|
+
|
13
|
+
public_class_method def self.generate(opts = {})
|
14
|
+
# Need to divide by two for wide characters
|
15
|
+
cols = opts[:cols].to_i
|
16
|
+
|
17
|
+
matrix_arr = [
|
18
|
+
0x30a0.chr('UTF-8'),
|
19
|
+
0x30a1.chr('UTF-8'),
|
20
|
+
0x30a2.chr('UTF-8'),
|
21
|
+
0x30a3.chr('UTF-8'),
|
22
|
+
0x30a4.chr('UTF-8'),
|
23
|
+
0x30a5.chr('UTF-8'),
|
24
|
+
0x30a6.chr('UTF-8'),
|
25
|
+
0x30a7.chr('UTF-8'),
|
26
|
+
0x30a8.chr('UTF-8'),
|
27
|
+
0x30a9.chr('UTF-8'),
|
28
|
+
0x30aa.chr('UTF-8'),
|
29
|
+
0x30ab.chr('UTF-8'),
|
30
|
+
0x30ac.chr('UTF-8'),
|
31
|
+
0x30ad.chr('UTF-8'),
|
32
|
+
0x30ae.chr('UTF-8'),
|
33
|
+
0x30af.chr('UTF-8'),
|
34
|
+
0x30b0.chr('UTF-8'),
|
35
|
+
0x30b1.chr('UTF-8'),
|
36
|
+
0x30b2.chr('UTF-8'),
|
37
|
+
0x30b3.chr('UTF-8'),
|
38
|
+
0x30b4.chr('UTF-8'),
|
39
|
+
0x30b5.chr('UTF-8'),
|
40
|
+
0x30b6.chr('UTF-8'),
|
41
|
+
0x30b7.chr('UTF-8'),
|
42
|
+
0x30b8.chr('UTF-8'),
|
43
|
+
0x30b9.chr('UTF-8'),
|
44
|
+
0x30ba.chr('UTF-8'),
|
45
|
+
0x30bb.chr('UTF-8'),
|
46
|
+
0x30bc.chr('UTF-8'),
|
47
|
+
0x30bd.chr('UTF-8'),
|
48
|
+
0x30be.chr('UTF-8'),
|
49
|
+
0x30bf.chr('UTF-8'),
|
50
|
+
0x30c0.chr('UTF-8'),
|
51
|
+
0x30c1.chr('UTF-8'),
|
52
|
+
0x30c2.chr('UTF-8'),
|
53
|
+
0x30c3.chr('UTF-8'),
|
54
|
+
0x30c4.chr('UTF-8'),
|
55
|
+
0x30c5.chr('UTF-8'),
|
56
|
+
0x30c6.chr('UTF-8'),
|
57
|
+
0x30c7.chr('UTF-8'),
|
58
|
+
0x30c8.chr('UTF-8'),
|
59
|
+
0x30c9.chr('UTF-8'),
|
60
|
+
0x30ca.chr('UTF-8'),
|
61
|
+
0x30cb.chr('UTF-8'),
|
62
|
+
0x30cc.chr('UTF-8'),
|
63
|
+
0x30cd.chr('UTF-8'),
|
64
|
+
0x30ce.chr('UTF-8'),
|
65
|
+
0x30cf.chr('UTF-8'),
|
66
|
+
0x30d0.chr('UTF-8'),
|
67
|
+
0x30d1.chr('UTF-8'),
|
68
|
+
0x30d2.chr('UTF-8'),
|
69
|
+
0x30d3.chr('UTF-8'),
|
70
|
+
0x30d4.chr('UTF-8'),
|
71
|
+
0x30d5.chr('UTF-8'),
|
72
|
+
0x30d6.chr('UTF-8'),
|
73
|
+
0x30d7.chr('UTF-8'),
|
74
|
+
0x30d8.chr('UTF-8'),
|
75
|
+
0x30d9.chr('UTF-8'),
|
76
|
+
0x30da.chr('UTF-8'),
|
77
|
+
0x30db.chr('UTF-8'),
|
78
|
+
0x30dc.chr('UTF-8'),
|
79
|
+
0x30dd.chr('UTF-8'),
|
80
|
+
0x30de.chr('UTF-8'),
|
81
|
+
0x30df.chr('UTF-8'),
|
82
|
+
0x30e0.chr('UTF-8'),
|
83
|
+
0x30e1.chr('UTF-8'),
|
84
|
+
0x30e2.chr('UTF-8'),
|
85
|
+
0x30e3.chr('UTF-8'),
|
86
|
+
0x30e4.chr('UTF-8'),
|
87
|
+
0x30e5.chr('UTF-8'),
|
88
|
+
0x30e6.chr('UTF-8'),
|
89
|
+
0x30e7.chr('UTF-8'),
|
90
|
+
0x30e8.chr('UTF-8'),
|
91
|
+
0x30e9.chr('UTF-8'),
|
92
|
+
0x30ea.chr('UTF-8'),
|
93
|
+
0x30eb.chr('UTF-8'),
|
94
|
+
0x30ec.chr('UTF-8'),
|
95
|
+
0x30ed.chr('UTF-8'),
|
96
|
+
0x30ee.chr('UTF-8'),
|
97
|
+
0x30ef.chr('UTF-8'),
|
98
|
+
0x30f0.chr('UTF-8'),
|
99
|
+
0x30f1.chr('UTF-8'),
|
100
|
+
0x30f2.chr('UTF-8'),
|
101
|
+
0x30f3.chr('UTF-8'),
|
102
|
+
0x30f4.chr('UTF-8'),
|
103
|
+
0x30f5.chr('UTF-8'),
|
104
|
+
0x30f6.chr('UTF-8'),
|
105
|
+
0x30f7.chr('UTF-8'),
|
106
|
+
0x30f8.chr('UTF-8'),
|
107
|
+
0x30f9.chr('UTF-8'),
|
108
|
+
0x30fa.chr('UTF-8'),
|
109
|
+
0x30fb.chr('UTF-8'),
|
110
|
+
0x30fc.chr('UTF-8'),
|
111
|
+
0x30fd.chr('UTF-8'),
|
112
|
+
0x30fe.chr('UTF-8'),
|
113
|
+
'0 ',
|
114
|
+
'1 ',
|
115
|
+
'2 ',
|
116
|
+
'3 ',
|
117
|
+
'4 ',
|
118
|
+
'5 ',
|
119
|
+
'6 ',
|
120
|
+
'7 ',
|
121
|
+
'8 ',
|
122
|
+
'9 ',
|
123
|
+
'A ',
|
124
|
+
'c ',
|
125
|
+
'R ',
|
126
|
+
'y ',
|
127
|
+
'P ',
|
128
|
+
't ',
|
129
|
+
'U ',
|
130
|
+
'm ',
|
131
|
+
'x ',
|
132
|
+
'Z ',
|
133
|
+
': ',
|
134
|
+
'{ ',
|
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
|
+
last_index = matrix_arr.length - 1
|
162
|
+
|
163
|
+
matrix_row = ''
|
164
|
+
most_cols = cols - 1
|
165
|
+
most_cols.times.each do
|
166
|
+
matrix_row += "#{matrix_arr[Random.rand(0..last_index)]} "
|
167
|
+
end
|
168
|
+
matrix_row += matrix_arr[Random.rand(0..last_index)]
|
169
|
+
rescue Interrupt
|
170
|
+
# Exit Gracefully if CTRL+C is Pressed During Session
|
171
|
+
Cryptum::UI::Exit.gracefully(which_self: self)
|
172
|
+
rescue StandardError => e
|
173
|
+
raise e
|
174
|
+
end
|
175
|
+
|
176
|
+
# Display Usage for this Module
|
177
|
+
|
178
|
+
public_class_method def self.help
|
179
|
+
puts "USAGE:
|
180
|
+
matrix_row = #{self}.generate(cols: Curses.cols)
|
181
|
+
"
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|