cryptum 0.0.355 → 0.0.356

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 (101) hide show
  1. checksums.yaml +4 -4
  2. metadata +13 -116
  3. data/.github/workflows/main.yml +0 -16
  4. data/.gitignore +0 -30
  5. data/.rspec +0 -3
  6. data/.rspec_status +0 -0
  7. data/.rubocop.yml +0 -31
  8. data/.rubocop_todo.yml +0 -32
  9. data/.ruby-gemset +0 -1
  10. data/.ruby-version +0 -1
  11. data/CODE_OF_CONDUCT.md +0 -84
  12. data/Gemfile +0 -38
  13. data/LICENSE +0 -674
  14. data/README.md +0 -87
  15. data/Rakefile +0 -19
  16. data/bin/cryptum +0 -73
  17. data/bin/cryptum-forecast +0 -200
  18. data/bin/cryptum-repl +0 -73
  19. data/bin/cryptum_autoinc_version +0 -38
  20. data/build_cryptum_gem.sh +0 -58
  21. data/cryptum.gemspec +0 -52
  22. data/cryptum_container.sh +0 -1
  23. data/docker/cryptum.json +0 -60
  24. data/docker/cryptum_container.sh +0 -59
  25. data/docker/packer_secrets.json.EXAMPLE +0 -7
  26. data/docker/provisioners/cryptum.sh +0 -11
  27. data/docker/provisioners/docker_bashrc.sh +0 -2
  28. data/docker/provisioners/docker_rvm.sh +0 -22
  29. data/docker/provisioners/init_image.sh +0 -28
  30. data/docker/provisioners/post_install.sh +0 -6
  31. data/docker/provisioners/ruby.sh +0 -16
  32. data/docker/provisioners/upload_globals.sh +0 -49
  33. data/etc/bot_confs/.gitkeep +0 -0
  34. data/etc/bot_confs/BOT_CONF.TEMPLATE +0 -10
  35. data/etc/coinbase_pro.yaml.EXAMPLE +0 -8
  36. data/etc/open_ai.yaml.EXAMPLE +0 -1
  37. data/git_commit.sh +0 -22
  38. data/lib/cryptum/api.rb +0 -688
  39. data/lib/cryptum/bot_conf.rb +0 -197
  40. data/lib/cryptum/event/bot_conf.rb +0 -34
  41. data/lib/cryptum/event/buy.rb +0 -145
  42. data/lib/cryptum/event/cancel.rb +0 -35
  43. data/lib/cryptum/event/exit.rb +0 -35
  44. data/lib/cryptum/event/gtfo.rb +0 -36
  45. data/lib/cryptum/event/history.rb +0 -105
  46. data/lib/cryptum/event/key_press.rb +0 -64
  47. data/lib/cryptum/event/order_book.rb +0 -34
  48. data/lib/cryptum/event/pane.rb +0 -65
  49. data/lib/cryptum/event/parse.rb +0 -181
  50. data/lib/cryptum/event/scroll.rb +0 -200
  51. data/lib/cryptum/event/sell.rb +0 -124
  52. data/lib/cryptum/event.rb +0 -27
  53. data/lib/cryptum/log.rb +0 -34
  54. data/lib/cryptum/matrix.rb +0 -181
  55. data/lib/cryptum/open_ai.rb +0 -156
  56. data/lib/cryptum/option/choice.rb +0 -28
  57. data/lib/cryptum/option.rb +0 -206
  58. data/lib/cryptum/order_book/generate.rb +0 -114
  59. data/lib/cryptum/order_book/indicator.rb +0 -15
  60. data/lib/cryptum/order_book/market_trend.rb +0 -137
  61. data/lib/cryptum/order_book/profit_margin.rb +0 -55
  62. data/lib/cryptum/order_book.rb +0 -19
  63. data/lib/cryptum/portfolio/balance.rb +0 -123
  64. data/lib/cryptum/portfolio.rb +0 -15
  65. data/lib/cryptum/ui/command.rb +0 -314
  66. data/lib/cryptum/ui/key_press_event.rb +0 -33
  67. data/lib/cryptum/ui/market_trend.rb +0 -74
  68. data/lib/cryptum/ui/order_execute_details.rb +0 -297
  69. data/lib/cryptum/ui/order_execution.rb +0 -573
  70. data/lib/cryptum/ui/order_plan.rb +0 -503
  71. data/lib/cryptum/ui/order_plan_details.rb +0 -240
  72. data/lib/cryptum/ui/order_timer.rb +0 -121
  73. data/lib/cryptum/ui/portfolio.rb +0 -221
  74. data/lib/cryptum/ui/signal_engine.rb +0 -109
  75. data/lib/cryptum/ui/terminal_window.rb +0 -111
  76. data/lib/cryptum/ui/ticker.rb +0 -319
  77. data/lib/cryptum/ui.rb +0 -343
  78. data/lib/cryptum/version.rb +0 -5
  79. data/lib/cryptum/web_sock/coinbase.rb +0 -102
  80. data/lib/cryptum/web_sock/event_machine.rb +0 -274
  81. data/lib/cryptum/web_sock.rb +0 -16
  82. data/lib/cryptum.rb +0 -120
  83. data/order_books/.gitkeep +0 -0
  84. data/reinstall_cryptum_gemset.sh +0 -29
  85. data/spec/lib/cryptum/api_spec.rb +0 -10
  86. data/spec/lib/cryptum/event_spec.rb +0 -10
  87. data/spec/lib/cryptum/log_spec.rb +0 -10
  88. data/spec/lib/cryptum/option_spec.rb +0 -10
  89. data/spec/lib/cryptum/order_book/generate_spec.rb +0 -10
  90. data/spec/lib/cryptum/order_book/market_trend_spec.rb +0 -10
  91. data/spec/lib/cryptum/order_book_spec.rb +0 -10
  92. data/spec/lib/cryptum/ui/command_spec.rb +0 -10
  93. data/spec/lib/cryptum/ui/ticker_spec.rb +0 -10
  94. data/spec/lib/cryptum/ui_spec.rb +0 -10
  95. data/spec/lib/cryptum/web_sock_spec.rb +0 -10
  96. data/spec/lib/cryptum_spec.rb +0 -10
  97. data/spec/spec_helper.rb +0 -3
  98. data/upgrade_Gemfile_gems.sh +0 -20
  99. data/upgrade_cryptum.sh +0 -13
  100. data/upgrade_gem.sh +0 -4
  101. data/upgrade_ruby.sh +0 -45
data/lib/cryptum/ui.rb DELETED
@@ -1,343 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'curses'
4
- require 'time'
5
-
6
- module Cryptum
7
- # Cryptum::UI Module used for Presenting the
8
- # Cryptum Curses Interface
9
- module UI
10
- require 'cryptum/ui/key_press_event'
11
- require 'cryptum/ui/terminal_window'
12
- require 'cryptum/ui/ticker'
13
- require 'cryptum/ui/portfolio'
14
- require 'cryptum/ui/order_plan'
15
- require 'cryptum/ui/order_plan_details'
16
- require 'cryptum/ui/order_timer'
17
- require 'cryptum/ui/market_trend'
18
- require 'cryptum/ui/signal_engine'
19
- require 'cryptum/ui/order_execution'
20
- require 'cryptum/ui/order_execute_details'
21
- require 'cryptum/ui/command'
22
-
23
- # Initialize the UI
24
- public_class_method def self.init
25
- # Initialize curses Screen
26
- Curses.init_screen
27
-
28
- # Ensure the cursor is invisible
29
- Curses.curs_set(0)
30
-
31
- # Do not echo keystrokes back to the UI
32
- Curses.noecho
33
-
34
- # Used to immediately evaluate characters submitted
35
- # without pressing ENTER (e.g. b, r, & w key events)
36
- Curses.crmode
37
- # Curses.nocrmode
38
- # Curses.raw # NO
39
- # Curses.noraw
40
- # Disable Line Buffering
41
- Curses.ESCDELAY = 0
42
-
43
- # Start Color!
44
- Curses.start_color
45
-
46
- # This is important to ensure -1 maintains
47
- # the original background color in the terminal
48
- # when defining color pairs
49
- Curses.use_default_colors
50
-
51
- # This object is used to pass all of the UI sections
52
- # around to various Cryptum modules
53
- Cryptum::UI::TerminalWindow.new
54
- rescue Interrupt
55
- # Exit Gracefully if CTRL+C is Pressed During Session
56
- Cryptum.exit_gracefully(which_self: self)
57
- rescue StandardError => e
58
- # Produce a Stacktrace for anything else
59
- Curses.close_screen
60
- raise e
61
- end
62
-
63
- # Create New Curses Window
64
- public_class_method def self.window(opts = {})
65
- height = opts[:height].to_i
66
- width = opts[:width].to_i
67
- top = opts[:top].to_i
68
- left = opts[:left].to_i
69
-
70
- window = Curses::Window.new(
71
- height,
72
- width,
73
- top,
74
- left
75
- )
76
- window.nodelay = true
77
-
78
- window
79
- rescue Interrupt
80
- # Exit Gracefully if CTRL+C is Pressed During Session
81
- Cryptum.exit_gracefully(which_self: self)
82
- rescue StandardError => e
83
- # Produce a Stacktrace for anything else
84
- Curses.close_screen
85
- raise e
86
- end
87
-
88
- # Draw a Box Around a Window
89
- public_class_method def self.line(opts = {})
90
- ui_win = opts[:ui_win]
91
- out_line_no = opts[:out_line_no].to_i
92
- color = opts[:color]
93
- color ||= :white
94
-
95
- style = :normal
96
- style = :bold unless color == :white
97
-
98
- ui_win.setpos(out_line_no, 0)
99
- colorize(
100
- ui_win: ui_win,
101
- color: color,
102
- style: style,
103
- string: "\u2500" * Curses.cols
104
- )
105
- rescue Interrupt
106
- # Exit Gracefully if CTRL+C is Pressed During Session
107
- Cryptum.exit_gracefully(which_self: self)
108
- rescue StandardError => e
109
- # Produce a Stacktrace for anything else
110
- Curses.close_screen
111
- raise e
112
- end
113
-
114
- # Jump to First Column
115
- public_class_method def self.colorize(opts = {})
116
- ui_win = opts[:ui_win]
117
- color = opts[:color].to_s.to_sym
118
- red = opts[:red].to_i
119
- green = opts[:green].to_i
120
- blue = opts[:blue].to_i
121
-
122
- style = opts[:style].to_s.to_sym
123
- style = :normal if opts[:style].nil?
124
-
125
- bg = opts[:bg].to_i
126
- bg = -1 if opts[:bg].nil?
127
-
128
- string = opts[:string]
129
-
130
- case color
131
- when :black
132
- # It's more Gray than Black
133
- # color_id = 0
134
- # color_fg = Curses::COLOR_BLACK
135
- color_id = 256
136
- Curses.init_color(color_id, 0, 0, 500)
137
- color_fg = color_id
138
- color_bg = bg
139
- when :red
140
- color_id = 1
141
- color_fg = Curses::COLOR_RED
142
- color_bg = bg
143
- when :green
144
- color_id = 2
145
- color_fg = Curses::COLOR_GREEN
146
- color_bg = bg
147
- when :yellow
148
- color_id = 3
149
- color_fg = Curses::COLOR_YELLOW
150
- color_bg = bg
151
- when :blue
152
- color_id = 4
153
- color_fg = Curses::COLOR_BLUE
154
- color_bg = bg
155
- when :magenta
156
- color_id = 5
157
- color_fg = Curses::COLOR_MAGENTA
158
- color_bg = bg
159
- when :cyan
160
- color_id = 6
161
- color_fg = Curses::COLOR_CYAN
162
- color_bg = bg
163
- when :white
164
- color_id = 7
165
- color_fg = Curses::COLOR_WHITE
166
- color_bg = bg
167
- when :rainbow
168
- color_id = 254
169
- red = Random.rand(0..1000)
170
- green = Random.rand(0..1000)
171
- blue = Random.rand(0..1000)
172
- Curses.init_color(color_id, red, green, blue)
173
- color_fg = color_id
174
- color_bg = bg
175
- when :custom
176
- color_id = 255
177
- Curses.init_color(color_id, red, green, blue)
178
- color_fg = color_id
179
- color_bg = bg
180
- else
181
- raise "Color Not Implemented for this Method: #{color}"
182
- end
183
-
184
- case style
185
- when :blink
186
- font = Curses::A_BLINK
187
- when :bold
188
- font = Curses::A_BOLD
189
- when :highlight
190
- font = Curses::A_STANDOUT
191
- when :normal
192
- font = Curses::A_NORMAL
193
- when :reverse
194
- font = Curses::A_REVERSE
195
- else
196
- raise "Font Style Not Implemented for this Method: #{style}"
197
- end
198
-
199
- Curses.init_pair(color_id, color_fg, color_bg)
200
- ui_win.attron(Curses.color_pair(color_id) | font) do
201
- ui_win.addstr(string)
202
- end
203
- rescue Interrupt
204
- # Exit Gracefully if CTRL+C is Pressed During Session
205
- Cryptum.exit_gracefully(which_self: self)
206
- rescue StandardError => e
207
- # Produce a Stacktrace for anything else
208
- Curses.close_screen
209
- raise e
210
- end
211
-
212
- # Jump to First Column
213
- public_class_method def self.col_center(opts = {})
214
- str = opts[:str]
215
-
216
- str_divided_by_two = str.length / 2
217
- (Curses.cols / 2) - str_divided_by_two
218
- rescue Interrupt
219
- # Exit Gracefully if CTRL+C is Pressed During Session
220
- Cryptum.exit_gracefully(which_self: self)
221
- rescue StandardError => e
222
- # Produce a Stacktrace for anything else
223
- Curses.close_screen
224
- raise e
225
- end
226
-
227
- public_class_method def self.col_first
228
- 0
229
- rescue Interrupt
230
- # Exit Gracefully if CTRL+C is Pressed During Session
231
- Cryptum.exit_gracefully(which_self: self)
232
- rescue StandardError => e
233
- # Produce a Stacktrace for anything else
234
- Curses.close_screen
235
- raise e
236
- end
237
-
238
- # Jump to Second Column
239
- public_class_method def self.col_second
240
- (Curses.cols / 8) + 5
241
- rescue Interrupt
242
- # Exit Gracefully if CTRL+C is Pressed During Session
243
- Cryptum.exit_gracefully(which_self: self)
244
- rescue StandardError => e
245
- # Produce a Stacktrace for anything else
246
- Curses.close_screen
247
- raise e
248
- end
249
-
250
- # Jump to Third Column
251
- public_class_method def self.col_third
252
- ((Curses.cols / 8) * 3) + 2
253
- rescue Interrupt
254
- # Exit Gracefully if CTRL+C is Pressed During Session
255
- Cryptum.exit_gracefully(which_self: self)
256
- rescue StandardError => e
257
- # Produce a Stacktrace for anything else
258
- Curses.close_screen
259
- raise e
260
- end
261
-
262
- # Jump to Fourth Column
263
- public_class_method def self.col_fourth
264
- ((Curses.cols / 4) * 3) - 3
265
- rescue Interrupt
266
- # Exit Gracefully if CTRL+C is Pressed During Session
267
- Cryptum.exit_gracefully(which_self: self)
268
- rescue StandardError => e
269
- # Produce a Stacktrace for anything else
270
- Curses.close_screen
271
- raise e
272
- end
273
-
274
- public_class_method def self.detect_key_press_in_ui(opts = {})
275
- key_press_event = opts[:key_press_event]
276
- ui_win = opts[:ui_win]
277
-
278
- key_press = ui_win.get_char
279
-
280
- # Useful for detecting and logging actual key presses to file
281
- # unless key_press.nil?
282
- # File.open('/tmp/detect_key_press_in_ui-cryptum.txt', 'a') do |f|
283
- # f.puts key_press.class
284
- # f.print key_press.inspect
285
- # f.puts "\n\n\n"
286
- # end
287
- # end
288
-
289
- case key_press
290
- when 'C'
291
- key_press_event.key_c = true
292
- when 'G'
293
- key_press_event.key_g = true
294
- when 'r'
295
- key_press_event.key_r = true
296
- when 'u'
297
- key_press_event.key_u = true
298
- when 'w'
299
- key_press_event.key_w = true
300
- when 'x'
301
- key_press_event.key_x = true
302
- when "\e"
303
- key_press_event.key_esc = true
304
- when "\n"
305
- key_press_event.key_enter = true
306
- when "\t"
307
- key_press_event.key_tab = true
308
- end
309
-
310
- # What a hack to detect special keys (-.-)
311
- if key_press_event.key_esc
312
- key_press_event.key_ansi = true if key_press == '['
313
- if key_press_event.key_ansi
314
- key_press_event.key_up_arrow = true if key_press == 'A'
315
- key_press_event.key_down_arrow = true if key_press == 'B'
316
- # NOTE: the ~ at the end of these keys are ignored
317
- # which may result in other keys working in place of them
318
- # e.g. home is \e[1~ but we know it's home as soon as
319
- # \e[1 is detected.
320
- key_press_event.key_page_up = true if key_press == '5'
321
- key_press_event.key_page_down = true if key_press == '6'
322
- key_press_event.key_home = true if key_press == '1'
323
- key_press_event.key_end = true if key_press == '4'
324
- end
325
- end
326
-
327
- key_press_event
328
- rescue Interrupt
329
- # Exit Gracefully if CTRL+C is Pressed During Session
330
- Cryptum.exit_gracefully(which_self: self)
331
- rescue StandardError => e
332
- # Produce a Stacktrace for anything else
333
- Curses.close_screen
334
- raise e
335
- end
336
-
337
- # Display a List of Every UI Module
338
-
339
- public_class_method def self.help
340
- constants.sort
341
- end
342
- end
343
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Cryptum
4
- VERSION = '0.0.355'
5
- end
@@ -1,102 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'faye/websocket'
4
- require 'websocket/extensions'
5
- require 'permessage_deflate'
6
-
7
- module Cryptum
8
- # This plugin is used to Establish a Web
9
- # Socket Connection with Coinbase
10
- module WebSock
11
- module Coinbase
12
- # Supported Method Parameters::
13
- # Cryptum::WebSock.connect(
14
- # )
15
- public_class_method def self.connect(opts = {})
16
- option_choice = opts[:option_choice]
17
- env = opts[:env]
18
-
19
- # cb_pro_ws_feed = 'wss://ws-feed.pro.coinbase.com'
20
- # cb_pro_ws_feed = 'wss://ws-feed-public.sandbox.pro.coinbase.com' if env[:env] == :sandbox
21
- cb_pro_ws_feed = 'wss://ws-feed.exchange.coinbase.com'
22
- cb_pro_ws_feed = 'wss://ws-feed-public.sandbox.exchange.coinbase.com' if env[:env] == :sandbox
23
-
24
- extensions = [PermessageDeflate]
25
-
26
- if option_choice.proxy
27
- tls_opts = {
28
- verify_peer: false
29
- }
30
-
31
- proxy_opts = {
32
- origin: option_choice.proxy
33
- }
34
-
35
- ws = Faye::WebSocket::Client.new(
36
- cb_pro_ws_feed,
37
- [],
38
- tls: tls_opts,
39
- proxy: proxy_opts,
40
- extensions: extensions,
41
- ping: 9
42
- )
43
- else
44
- ws = Faye::WebSocket::Client.new(
45
- cb_pro_ws_feed,
46
- [],
47
- extensions: extensions,
48
- ping: 9
49
- )
50
- end
51
-
52
- ws
53
- rescue Interrupt
54
- # Exit Gracefully if CTRL+C is Pressed During Session
55
- Cryptum.exit_gracefully(which_self: self)
56
- rescue StandardError => e
57
- raise e
58
- end
59
-
60
- public_class_method def self.subscribe_message(opts = {})
61
- option_choice = opts[:option_choice]
62
- env = opts[:env]
63
- product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
64
-
65
- api_secret = env[:api_secret]
66
- api_signature_response = Cryptum::API.generate_signature(
67
- api_secret: api_secret
68
- )
69
- api_key = env[:api_key]
70
- api_passphrase = env[:api_passphrase]
71
- api_timestamp = api_signature_response[:api_timestamp]
72
- api_signature = api_signature_response[:api_signature]
73
-
74
- "{
75
- \"type\": \"subscribe\",
76
- \"product_ids\": [
77
- \"#{product_id}\"
78
- ],
79
- \"channels\": [
80
- \"level2_batch\",
81
- \"ticker\",
82
- \"user\"
83
- ],
84
- \"key\": \"#{api_key}\",
85
- \"passphrase\": \"#{api_passphrase}\",
86
- \"timestamp\": \"#{api_timestamp}\",
87
- \"signature\": \"#{api_signature}\"
88
- }"
89
- rescue StandardError => e
90
- raise e
91
- end
92
-
93
- # Display Usage for this Module
94
-
95
- public_class_method def self.help
96
- puts "USAGE:
97
- logger = #{self}.create()
98
- "
99
- end
100
- end
101
- end
102
- end