cryptum 0.0.381 → 0.0.383

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/.rubocop_todo.yml +11 -8
  4. data/Gemfile +1 -2
  5. data/bin/cryptum +2 -2
  6. data/lib/cryptum/api/exchange_rates.rb +0 -2
  7. data/lib/cryptum/api/orders.rb +9 -7
  8. data/lib/cryptum/api/portfolio.rb +0 -2
  9. data/lib/cryptum/api/rest.rb +3 -4
  10. data/lib/cryptum/api/signature.rb +0 -4
  11. data/lib/cryptum/api.rb +1 -40
  12. data/lib/cryptum/bot_conf.rb +14 -6
  13. data/lib/cryptum/event/exit.rb +1 -1
  14. data/lib/cryptum/event/history.rb +4 -1
  15. data/lib/cryptum/event/parse.rb +6 -6
  16. data/lib/cryptum/event.rb +0 -2
  17. data/lib/cryptum/log.rb +18 -4
  18. data/lib/cryptum/open_ai.rb +129 -32
  19. data/lib/cryptum/option/choice.rb +1 -1
  20. data/lib/cryptum/option/environment.rb +0 -2
  21. data/lib/cryptum/option/parser.rb +0 -2
  22. data/lib/cryptum/order_book/generate.rb +3 -8
  23. data/lib/cryptum/order_book.rb +0 -3
  24. data/lib/cryptum/portfolio.rb +0 -2
  25. data/lib/cryptum/ui/command.rb +1 -3
  26. data/lib/cryptum/ui/exit.rb +43 -0
  27. data/lib/cryptum/ui/key_press_event.rb +1 -1
  28. data/lib/cryptum/ui/market_trend.rb +4 -3
  29. data/lib/cryptum/ui/matrix.rb +185 -0
  30. data/lib/cryptum/ui/order/execute.rb +629 -0
  31. data/lib/cryptum/ui/order/execute_details.rb +300 -0
  32. data/lib/cryptum/ui/order/plan.rb +518 -0
  33. data/lib/cryptum/ui/order/plan_details.rb +243 -0
  34. data/lib/cryptum/ui/order/timer.rb +140 -0
  35. data/lib/cryptum/ui/order.rb +21 -0
  36. data/lib/cryptum/ui/portfolio.rb +5 -3
  37. data/lib/cryptum/ui/signal_engine.rb +1 -3
  38. data/lib/cryptum/ui/terminal_window.rb +1 -3
  39. data/lib/cryptum/ui/ticker.rb +4 -3
  40. data/lib/cryptum/ui.rb +17 -22
  41. data/lib/cryptum/version.rb +1 -1
  42. data/lib/cryptum/web_sock/coinbase.rb +1 -6
  43. data/lib/cryptum/web_sock/event_machine.rb +3 -7
  44. data/lib/cryptum.rb +16 -33
  45. data/spec/lib/cryptum/{matrix_spec.rb → ui/exit_spec.rb} +2 -2
  46. data/spec/lib/cryptum/ui/{order_plan_spec.rb → matrix_spec.rb} +2 -2
  47. data/spec/lib/cryptum/ui/{order_execute_details_spec.rb → order/execute_details_spec.rb} +2 -2
  48. data/spec/lib/cryptum/ui/{order_execution_spec.rb → order/execute_spec.rb} +2 -2
  49. data/spec/lib/cryptum/ui/{order_plan_details_spec.rb → order/plan_details_spec.rb} +2 -2
  50. data/spec/lib/cryptum/ui/order/plan_spec.rb +10 -0
  51. data/spec/lib/cryptum/ui/order/timer_spec.rb +10 -0
  52. data/spec/lib/cryptum/ui/{order_timer_spec.rb → order_spec.rb} +2 -2
  53. metadata +20 -30
  54. data/lib/cryptum/matrix.rb +0 -181
  55. data/lib/cryptum/ui/order_execute_details.rb +0 -297
  56. data/lib/cryptum/ui/order_execution.rb +0 -624
  57. data/lib/cryptum/ui/order_plan.rb +0 -514
  58. data/lib/cryptum/ui/order_plan_details.rb +0 -240
  59. data/lib/cryptum/ui/order_timer.rb +0 -136
data/lib/cryptum.rb CHANGED
@@ -1,10 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # All the 3rd party gems used in this application
4
+ require 'addressable'
5
+ require 'base64'
6
+ require 'curses'
7
+ require 'eventmachine'
8
+ require 'faye/websocket'
9
+ require 'fileutils'
10
+ require 'json'
11
+ require 'logger'
12
+ require 'openssl'
13
+ require 'optparse'
14
+ require 'permessage_deflate'
3
15
  require 'rbtrace'
16
+ require 'rest-client'
17
+ require 'time'
4
18
  require 'yaml'
5
- require 'json'
6
- require 'fileutils'
7
- require 'tty-spinner'
19
+ require 'websocket/extensions'
20
+
8
21
  # Root-Level Namespace for cryptum
9
22
  module Cryptum
10
23
  $stdout.sync = true
@@ -14,7 +27,6 @@ module Cryptum
14
27
  require 'cryptum/bot_conf'
15
28
  require 'cryptum/event'
16
29
  require 'cryptum/log'
17
- require 'cryptum/matrix'
18
30
  require 'cryptum/open_ai'
19
31
  require 'cryptum/option'
20
32
  require 'cryptum/order_book'
@@ -85,35 +97,6 @@ module Cryptum
85
97
  raise e
86
98
  end
87
99
 
88
- public_class_method def self.exit_gracefully(opts = {})
89
- which_self = opts[:which_self]
90
- event_history = opts[:event_history]
91
- # option_choice = opts[:option_choice]
92
- # env = opts[:env]
93
-
94
- # Clear out candle data to ensure
95
- # Cryptum Statistics Only Apply to
96
- # Live Sessions
97
- if event_history
98
- File.write(
99
- order_book_file,
100
- JSON.pretty_generate(event_history.order_book)
101
- )
102
- end
103
-
104
- Curses.close_screen
105
- puts "Interrupt detected in #{which_self}...goodbye."
106
-
107
- exit 0
108
- rescue NameError
109
- puts "\nInterrupt detected in #{which_self}...goodbye."
110
-
111
- exit 0
112
- rescue StandardError => e
113
- # Produce a Stacktrace for anything else
114
- raise e
115
- end
116
-
117
100
  public_class_method def self.help
118
101
  constants.sort
119
102
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe Cryptum::Matrix do
5
+ describe Cryptum::UI::Exit do
6
6
  it 'should display information for existing help method' do
7
- help_response = Cryptum::Matrix
7
+ help_response = Cryptum::UI::Exit
8
8
  expect(help_response).to respond_to :help
9
9
  end
10
10
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe Cryptum::UI::OrderPlan do
5
+ describe Cryptum::UI::Matrix do
6
6
  it 'should display information for existing help method' do
7
- help_response = Cryptum::UI::OrderPlan
7
+ help_response = Cryptum::UI::Matrix
8
8
  expect(help_response).to respond_to :help
9
9
  end
10
10
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe Cryptum::UI::OrderExecuteDetails do
5
+ describe Cryptum::UI::Order::ExecuteDetails do
6
6
  it 'should display information for existing help method' do
7
- help_response = Cryptum::UI::OrderExecuteDetails
7
+ help_response = Cryptum::UI::Order::ExecuteDetails
8
8
  expect(help_response).to respond_to :help
9
9
  end
10
10
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe Cryptum::UI::OrderExecution do
5
+ describe Cryptum::UI::Order::Execute do
6
6
  it 'should display information for existing help method' do
7
- help_response = Cryptum::UI::OrderExecution
7
+ help_response = Cryptum::UI::Order::Execute
8
8
  expect(help_response).to respond_to :help
9
9
  end
10
10
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe Cryptum::UI::OrderPlanDetails do
5
+ describe Cryptum::UI::Order::PlanDetails do
6
6
  it 'should display information for existing help method' do
7
- help_response = Cryptum::UI::OrderPlanDetails
7
+ help_response = Cryptum::UI::Order::PlanDetails
8
8
  expect(help_response).to respond_to :help
9
9
  end
10
10
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Cryptum::UI::Order::Plan do
6
+ it 'should display information for existing help method' do
7
+ help_response = Cryptum::UI::Order::Plan
8
+ expect(help_response).to respond_to :help
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Cryptum::UI::Order::Timer do
6
+ it 'should display information for existing help method' do
7
+ help_response = Cryptum::UI::Order::Timer
8
+ expect(help_response).to respond_to :help
9
+ end
10
+ end
@@ -2,9 +2,9 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe Cryptum::UI::OrderTimer do
5
+ describe Cryptum::UI::Order do
6
6
  it 'should display information for existing help method' do
7
- help_response = Cryptum::UI::OrderTimer
7
+ help_response = Cryptum::UI::Order
8
8
  expect(help_response).to respond_to :help
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.381
4
+ version: 0.0.383
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-30 00:00:00.000000000 Z
11
+ date: 2023-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -310,14 +310,14 @@ dependencies:
310
310
  requirements:
311
311
  - - '='
312
312
  - !ruby/object:Gem::Version
313
- version: 1.8.1
313
+ version: 1.8.2
314
314
  type: :runtime
315
315
  prerelease: false
316
316
  version_requirements: !ruby/object:Gem::Requirement
317
317
  requirements:
318
318
  - - '='
319
319
  - !ruby/object:Gem::Version
320
- version: 1.8.1
320
+ version: 1.8.2
321
321
  - !ruby/object:Gem::Dependency
322
322
  name: tty-prompt
323
323
  requirement: !ruby/object:Gem::Requirement
@@ -332,20 +332,6 @@ dependencies:
332
332
  - - '='
333
333
  - !ruby/object:Gem::Version
334
334
  version: 0.23.1
335
- - !ruby/object:Gem::Dependency
336
- name: tty-spinner
337
- requirement: !ruby/object:Gem::Requirement
338
- requirements:
339
- - - '='
340
- - !ruby/object:Gem::Version
341
- version: 0.9.3
342
- type: :runtime
343
- prerelease: false
344
- version_requirements: !ruby/object:Gem::Requirement
345
- requirements:
346
- - - '='
347
- - !ruby/object:Gem::Version
348
- version: 0.9.3
349
335
  - !ruby/object:Gem::Dependency
350
336
  name: websocket-extensions
351
337
  requirement: !ruby/object:Gem::Requirement
@@ -431,7 +417,6 @@ files:
431
417
  - lib/cryptum/event/scroll.rb
432
418
  - lib/cryptum/event/sell.rb
433
419
  - lib/cryptum/log.rb
434
- - lib/cryptum/matrix.rb
435
420
  - lib/cryptum/open_ai.rb
436
421
  - lib/cryptum/option.rb
437
422
  - lib/cryptum/option/choice.rb
@@ -447,13 +432,16 @@ files:
447
432
  - lib/cryptum/portfolio/balance.rb
448
433
  - lib/cryptum/ui.rb
449
434
  - lib/cryptum/ui/command.rb
435
+ - lib/cryptum/ui/exit.rb
450
436
  - lib/cryptum/ui/key_press_event.rb
451
437
  - lib/cryptum/ui/market_trend.rb
452
- - lib/cryptum/ui/order_execute_details.rb
453
- - lib/cryptum/ui/order_execution.rb
454
- - lib/cryptum/ui/order_plan.rb
455
- - lib/cryptum/ui/order_plan_details.rb
456
- - lib/cryptum/ui/order_timer.rb
438
+ - lib/cryptum/ui/matrix.rb
439
+ - lib/cryptum/ui/order.rb
440
+ - lib/cryptum/ui/order/execute.rb
441
+ - lib/cryptum/ui/order/execute_details.rb
442
+ - lib/cryptum/ui/order/plan.rb
443
+ - lib/cryptum/ui/order/plan_details.rb
444
+ - lib/cryptum/ui/order/timer.rb
457
445
  - lib/cryptum/ui/portfolio.rb
458
446
  - lib/cryptum/ui/signal_engine.rb
459
447
  - lib/cryptum/ui/terminal_window.rb
@@ -488,7 +476,6 @@ files:
488
476
  - spec/lib/cryptum/event/sell_spec.rb
489
477
  - spec/lib/cryptum/event_spec.rb
490
478
  - spec/lib/cryptum/log_spec.rb
491
- - spec/lib/cryptum/matrix_spec.rb
492
479
  - spec/lib/cryptum/open_ai_spec.rb
493
480
  - spec/lib/cryptum/option/choice_spec.rb
494
481
  - spec/lib/cryptum/option/environment_spec.rb
@@ -503,13 +490,16 @@ files:
503
490
  - spec/lib/cryptum/portfolio/balance_spec.rb
504
491
  - spec/lib/cryptum/portfolio_spec.rb
505
492
  - spec/lib/cryptum/ui/command_spec.rb
493
+ - spec/lib/cryptum/ui/exit_spec.rb
506
494
  - spec/lib/cryptum/ui/key_press_event_spec.rb
507
495
  - spec/lib/cryptum/ui/market_trend_spec.rb
508
- - spec/lib/cryptum/ui/order_execute_details_spec.rb
509
- - spec/lib/cryptum/ui/order_execution_spec.rb
510
- - spec/lib/cryptum/ui/order_plan_details_spec.rb
511
- - spec/lib/cryptum/ui/order_plan_spec.rb
512
- - spec/lib/cryptum/ui/order_timer_spec.rb
496
+ - spec/lib/cryptum/ui/matrix_spec.rb
497
+ - spec/lib/cryptum/ui/order/execute_details_spec.rb
498
+ - spec/lib/cryptum/ui/order/execute_spec.rb
499
+ - spec/lib/cryptum/ui/order/plan_details_spec.rb
500
+ - spec/lib/cryptum/ui/order/plan_spec.rb
501
+ - spec/lib/cryptum/ui/order/timer_spec.rb
502
+ - spec/lib/cryptum/ui/order_spec.rb
513
503
  - spec/lib/cryptum/ui/portfolio_spec.rb
514
504
  - spec/lib/cryptum/ui/signal_engine_spec.rb
515
505
  - spec/lib/cryptum/ui/terminal_window_spec.rb
@@ -1,181 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'logger'
4
-
5
- module Cryptum
6
- # This plugin is used for my own entertainment
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 StandardError => e
170
- raise e
171
- end
172
-
173
- # Display Usage for this Module
174
-
175
- public_class_method def self.help
176
- puts "USAGE:
177
- logger = #{self}.create()
178
- "
179
- end
180
- end
181
- end