cryptum 0.0.265 → 0.0.267
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +8 -23
- data/Gemfile +1 -1
- data/lib/cryptum/event/history.rb +4 -0
- data/lib/cryptum/event/pane.rb +41 -0
- data/lib/cryptum/event/scroll.rb +2 -2
- data/lib/cryptum/option.rb +5 -4
- data/lib/cryptum/order_book/market_trend.rb +6 -4
- data/lib/cryptum/order_execute_details.rb +56 -0
- data/lib/cryptum/ui/order_plan_details.rb +56 -0
- data/lib/cryptum/ui/terminal_window.rb +16 -0
- data/lib/cryptum/ui.rb +2 -0
- data/lib/cryptum/version.rb +1 -1
- data/lib/cryptum/web_sock/event_machine.rb +4 -4
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2062d12344f14e33eb69ae94a6590348e11ece15f71faf88fb29c9ae41917d0
|
4
|
+
data.tar.gz: 8928742f4e03be3180e453456f968d7e5899b73633c88f022622df8db13b7cd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25f5c7e69a16c95f47c27ad94eee574b9efa84d3a8907a8421bb5b89fdcee2abae4120aa546a46f89ca80f4598ad04a7adbdb16ab800034876dc9429227c8822
|
7
|
+
data.tar.gz: c5c942d55ce5a293c7126c214417c057968048ae60ba489caae66720a6956dd7fd393d57f8d721f0995a77fad92f51dcd1b9647a6833804381256aa2e3be9d9f
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2022-12-
|
3
|
+
# on 2022-12-03 04:05:10 UTC using RuboCop version 1.39.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
|
@@ -102,26 +102,11 @@ Layout/TrailingWhitespace:
|
|
102
102
|
- 'lib/cryptum/ui/order_plan.rb'
|
103
103
|
- 'lib/cryptum/ui/order_timer.rb'
|
104
104
|
|
105
|
-
# Offense count:
|
105
|
+
# Offense count: 75
|
106
106
|
Lint/UselessAssignment:
|
107
|
-
|
108
|
-
- 'bin/cryptum-forecast'
|
109
|
-
- 'lib/cryptum.rb'
|
110
|
-
- 'lib/cryptum/api.rb'
|
111
|
-
- 'lib/cryptum/event.rb'
|
112
|
-
- 'lib/cryptum/event/buy.rb'
|
113
|
-
- 'lib/cryptum/event/scroll.rb'
|
114
|
-
- 'lib/cryptum/order_book/generate.rb'
|
115
|
-
- 'lib/cryptum/order_book/market_trend.rb'
|
116
|
-
- 'lib/cryptum/ui/market_trend.rb'
|
117
|
-
- 'lib/cryptum/ui/order_execution.rb'
|
118
|
-
- 'lib/cryptum/ui/order_plan.rb'
|
119
|
-
- 'lib/cryptum/ui/order_timer.rb'
|
120
|
-
- 'lib/cryptum/ui/portfolio.rb'
|
121
|
-
- 'lib/cryptum/ui/signal_engine.rb'
|
122
|
-
- 'lib/cryptum/ui/ticker.rb'
|
107
|
+
Enabled: false
|
123
108
|
|
124
|
-
# Offense count:
|
109
|
+
# Offense count: 47
|
125
110
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
126
111
|
Metrics/AbcSize:
|
127
112
|
Max: 400
|
@@ -137,17 +122,17 @@ Metrics/BlockLength:
|
|
137
122
|
Metrics/BlockNesting:
|
138
123
|
Max: 4
|
139
124
|
|
140
|
-
# Offense count:
|
125
|
+
# Offense count: 19
|
141
126
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
142
127
|
Metrics/CyclomaticComplexity:
|
143
128
|
Max: 73
|
144
129
|
|
145
|
-
# Offense count:
|
130
|
+
# Offense count: 66
|
146
131
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
147
132
|
Metrics/MethodLength:
|
148
133
|
Max: 383
|
149
134
|
|
150
|
-
# Offense count:
|
135
|
+
# Offense count: 16
|
151
136
|
# Configuration parameters: CountComments, CountAsOne.
|
152
137
|
Metrics/ModuleLength:
|
153
138
|
Max: 538
|
@@ -246,7 +231,7 @@ Style/TrailingCommaInArrayLiteral:
|
|
246
231
|
Exclude:
|
247
232
|
- 'lib/cryptum/matrix.rb'
|
248
233
|
|
249
|
-
# Offense count:
|
234
|
+
# Offense count: 18
|
250
235
|
# This cop supports safe autocorrection (--autocorrect).
|
251
236
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
|
252
237
|
# URISchemes: http, https
|
data/Gemfile
CHANGED
@@ -25,10 +25,12 @@ module Cryptum
|
|
25
25
|
:time_between_orders_min,
|
26
26
|
:time_between_orders_reset,
|
27
27
|
:order_plan_win_active,
|
28
|
+
:order_plan_details_win_active,
|
28
29
|
:order_plan_index_offset,
|
29
30
|
:order_plan_max_rows_to_display,
|
30
31
|
:order_plan_row_to_select,
|
31
32
|
:order_execute_win_active,
|
33
|
+
:order_execute_details_win_active,
|
32
34
|
:order_execute_index_offset,
|
33
35
|
:order_execute_max_rows_to_display,
|
34
36
|
:order_execute_row_to_select
|
@@ -49,10 +51,12 @@ module Cryptum
|
|
49
51
|
self.reconnected = false
|
50
52
|
self.red_pill = false
|
51
53
|
self.order_plan_win_active = true
|
54
|
+
self.order_plan_details_win_active = false
|
52
55
|
self.order_plan_index_offset = 0
|
53
56
|
self.order_plan_max_rows_to_display = 6
|
54
57
|
self.order_plan_row_to_select = order_plan_index_offset
|
55
58
|
self.order_execute_win_active = false
|
59
|
+
self.order_execute_details_win_active = false
|
56
60
|
self.order_execute_index_offset = 0
|
57
61
|
self.order_execute_max_rows_to_display = 6
|
58
62
|
self.order_execute_row_to_select = order_execute_index_offset
|
data/lib/cryptum/event/pane.rb
CHANGED
@@ -25,10 +25,51 @@ module Cryptum
|
|
25
25
|
raise e
|
26
26
|
end
|
27
27
|
|
28
|
+
# Supported Method Parameters::
|
29
|
+
# Cryptum::Event::Pane.toggle_details(
|
30
|
+
# )
|
31
|
+
public_class_method def self.toggle_details(opts = {})
|
32
|
+
terminal_win = opts[:terminal_win]
|
33
|
+
event_history = opts[:event_history]
|
34
|
+
|
35
|
+
terminal_win.key_press_event.key_enter = false
|
36
|
+
|
37
|
+
if event_history.order_plan_win_active &&
|
38
|
+
!event_history.order_plan_details_win_active &&
|
39
|
+
!event_history.order_execute_win_active
|
40
|
+
|
41
|
+
event_history.order_plan_win_active = false
|
42
|
+
event_history.order_plan_details_win_active = true
|
43
|
+
elsif !event_history.order_plan_win_active &&
|
44
|
+
event_history.order_plan_details_win_active &&
|
45
|
+
!event_history.order_execute_win_active
|
46
|
+
|
47
|
+
event_history.order_plan_win_active = true
|
48
|
+
event_history.order_plan_details_win_active = false
|
49
|
+
end
|
50
|
+
|
51
|
+
if event_history.order_execute_win_active &&
|
52
|
+
!event_history.order_execute_details_win_active &&
|
53
|
+
!event_history.order_plan_win_active
|
54
|
+
|
55
|
+
event_history.order_execute_win_active = false
|
56
|
+
event_history.order_execute_details_win_active = true
|
57
|
+
elsif !event_history.order_execute_win_active &&
|
58
|
+
event_history.order_execute_details_win_active &&
|
59
|
+
!event_history.order_plan_win_active
|
60
|
+
|
61
|
+
event_history.order_execute_win_active = true
|
62
|
+
event_history.order_execute_details_win_active = false
|
63
|
+
end
|
64
|
+
rescue StandardError => e
|
65
|
+
raise e
|
66
|
+
end
|
67
|
+
|
28
68
|
# Display Usage for this Module
|
29
69
|
public_class_method def self.help
|
30
70
|
puts "USAGE:
|
31
71
|
#{self}.switch()
|
72
|
+
#{self}.toggle_details()
|
32
73
|
"
|
33
74
|
end
|
34
75
|
end
|
data/lib/cryptum/event/scroll.rb
CHANGED
@@ -73,14 +73,14 @@ module Cryptum
|
|
73
73
|
|
74
74
|
if event_history.order_plan_win_active
|
75
75
|
event_history.order_plan_row_to_select = 0
|
76
|
-
event_history.order_plan_index_offset -= event_history.order_plan_max_rows_to_display
|
76
|
+
event_history.order_plan_index_offset -= event_history.order_plan_max_rows_to_display + 1
|
77
77
|
event_history.order_plan_index_offset = 0 if event_history.order_plan_index_offset.negative?
|
78
78
|
event_history.order_plan_row_to_select = 0 if event_history.order_plan_row_to_select.negative?
|
79
79
|
end
|
80
80
|
|
81
81
|
if event_history.order_execute_win_active
|
82
82
|
event_history.order_execute_row_to_select = 0
|
83
|
-
event_history.order_execute_index_offset -= event_history.order_execute_max_rows_to_display
|
83
|
+
event_history.order_execute_index_offset -= event_history.order_execute_max_rows_to_display + 1
|
84
84
|
event_history.order_execute_index_offset = 0 if event_history.order_execute_index_offset.negative?
|
85
85
|
event_history.order_execute_row_to_select = 0 if event_history.order_execute_row_to_select.negative?
|
86
86
|
end
|
data/lib/cryptum/option.rb
CHANGED
@@ -56,7 +56,7 @@ module Cryptum
|
|
56
56
|
options.on(
|
57
57
|
'-tSECONDS',
|
58
58
|
'--time-between-market-trend-reset=SECONDS',
|
59
|
-
'<Optional - Seconds Between Market Trend Reset (Default
|
59
|
+
'<Optional - Seconds Between Market Trend Reset (Default 3_600 i.e. 1 hour)>'
|
60
60
|
) { |t| option_choice.market_trend_reset = t.to_i }
|
61
61
|
end.parse!
|
62
62
|
|
@@ -89,8 +89,9 @@ module Cryptum
|
|
89
89
|
reason = :repo_root
|
90
90
|
end
|
91
91
|
|
92
|
-
option_choice.market_trend_reset =
|
93
|
-
unless option_choice.market_trend_reset.to_i
|
92
|
+
option_choice.market_trend_reset = 3_600 if option_choice.market_trend_reset.to_i.zero?
|
93
|
+
unless option_choice.market_trend_reset.to_i >= 60 &&
|
94
|
+
option_choice.market_trend_reset <= 86_400
|
94
95
|
usage = true
|
95
96
|
reason = :market_trend_reset
|
96
97
|
end
|
@@ -113,7 +114,7 @@ module Cryptum
|
|
113
114
|
when :repo_root
|
114
115
|
puts "ERROR: #{option_choice.repo_root} does not exist.\n\n"
|
115
116
|
when :market_trend_reset
|
116
|
-
puts "ERROR: #{option_choice.market_trend_reset} Must be a positive
|
117
|
+
puts "ERROR: #{option_choice.market_trend_reset} Must be a positive integer between 60-86_400.\n\n"
|
117
118
|
end
|
118
119
|
|
119
120
|
puts `#{option_choice.driver_name} --help`
|
@@ -33,11 +33,13 @@ module Cryptum
|
|
33
33
|
|
34
34
|
# order_difference = 0
|
35
35
|
if buy_total > sell_total
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
# Too expensive
|
37
|
+
# order_difference = Cryptum.beautify_large_number(
|
38
|
+
# value: buy_total - sell_total
|
39
|
+
# ).to_i
|
40
|
+
order_difference = buy_total - sell_total
|
39
41
|
indicator_hash[:color] = :green
|
40
|
-
indicator_hash[:ui] = "BUYS UP BY #{order_difference}"
|
42
|
+
indicator_hash[:ui] = "BUYS UP BY #{order_difference.to_i}"
|
41
43
|
indicator_hash[:status] = "B#{Cryptum.up_arrow}"
|
42
44
|
elsif buy_total < sell_total
|
43
45
|
order_difference = Cryptum.beautify_large_number(
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
module Cryptum
|
6
|
+
module UI
|
7
|
+
# This plugin is used to Display Order Execute Details
|
8
|
+
# selected from the Order Execute Window Pane.
|
9
|
+
module OrderExecuteDetails
|
10
|
+
# Supported Method Parameters::
|
11
|
+
# Cryptum::UI::OrderExecuteDetails.refresh(
|
12
|
+
# )
|
13
|
+
|
14
|
+
public_class_method def self.refresh(opts = {})
|
15
|
+
option_choice = opts[:option_choice]
|
16
|
+
event_history = opts[:event_history]
|
17
|
+
order_execute_details_win = opts[:order_execute_details_win]
|
18
|
+
indicator_status = opts[:indicator_status]
|
19
|
+
key_press_event = opts[:key_press_event]
|
20
|
+
|
21
|
+
color = :white
|
22
|
+
|
23
|
+
# UI
|
24
|
+
col_just4 = (Curses.cols - Cryptum::UI.col_fourth) - 1
|
25
|
+
|
26
|
+
# ROW 1
|
27
|
+
# COLUMN 1
|
28
|
+
out_line_no = 0
|
29
|
+
order_execute_details_win.setpos(out_line_no, Cryptum::UI.col_first)
|
30
|
+
order_execute_details_win.clrtoeol
|
31
|
+
Cryptum::UI.colorize(
|
32
|
+
ui_win: order_execute_details_win,
|
33
|
+
color: :white,
|
34
|
+
style: :bold,
|
35
|
+
string: 'Order Details'
|
36
|
+
)
|
37
|
+
|
38
|
+
order_execute_details_win.refresh
|
39
|
+
rescue Interrupt
|
40
|
+
# Exit Gracefully if CTRL+C is Pressed During Session
|
41
|
+
Cryptum.exit_gracefully(which_self: self)
|
42
|
+
rescue StandardError => e
|
43
|
+
raise e
|
44
|
+
end
|
45
|
+
|
46
|
+
# Display Usage for this Module
|
47
|
+
|
48
|
+
public_class_method def self.help
|
49
|
+
puts "USAGE:
|
50
|
+
#{self}.refresh(
|
51
|
+
)
|
52
|
+
"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
module Cryptum
|
6
|
+
module UI
|
7
|
+
# This plugin is used to Display Order Plan Details
|
8
|
+
# selected from the Order Plan Window Pane.
|
9
|
+
module OrderPlanDetails
|
10
|
+
# Supported Method Parameters::
|
11
|
+
# Cryptum::UI::OrderPlanDetails.refresh(
|
12
|
+
# )
|
13
|
+
|
14
|
+
public_class_method def self.refresh(opts = {})
|
15
|
+
option_choice = opts[:option_choice]
|
16
|
+
event_history = opts[:event_history]
|
17
|
+
order_plan_details_win = opts[:order_plan_details_win]
|
18
|
+
indicator_status = opts[:indicator_status]
|
19
|
+
key_press_event = opts[:key_press_event]
|
20
|
+
|
21
|
+
color = :white
|
22
|
+
|
23
|
+
# UI
|
24
|
+
col_just4 = (Curses.cols - Cryptum::UI.col_fourth) - 1
|
25
|
+
|
26
|
+
# ROW 1
|
27
|
+
# COLUMN 1
|
28
|
+
out_line_no = 0
|
29
|
+
order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
|
30
|
+
order_plan_details_win.clrtoeol
|
31
|
+
Cryptum::UI.colorize(
|
32
|
+
ui_win: order_plan_details_win,
|
33
|
+
color: :white,
|
34
|
+
style: :bold,
|
35
|
+
string: 'Order Details'
|
36
|
+
)
|
37
|
+
|
38
|
+
order_plan_details_win.refresh
|
39
|
+
rescue Interrupt
|
40
|
+
# Exit Gracefully if CTRL+C is Pressed During Session
|
41
|
+
Cryptum.exit_gracefully(which_self: self)
|
42
|
+
rescue StandardError => e
|
43
|
+
raise e
|
44
|
+
end
|
45
|
+
|
46
|
+
# Display Usage for this Module
|
47
|
+
|
48
|
+
public_class_method def self.help
|
49
|
+
puts "USAGE:
|
50
|
+
#{self}.refresh(
|
51
|
+
)
|
52
|
+
"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -13,11 +13,13 @@ module Cryptum
|
|
13
13
|
:ticker_section,
|
14
14
|
:portfolio_section,
|
15
15
|
:order_plan_section,
|
16
|
+
:order_plan_details_section,
|
16
17
|
:order_timer_section,
|
17
18
|
:market_trend_section,
|
18
19
|
:market_trend_ui_resize,
|
19
20
|
:signal_engine_section,
|
20
21
|
:order_execute_section,
|
22
|
+
:order_execute_details_section,
|
21
23
|
:command_section
|
22
24
|
|
23
25
|
def initialize
|
@@ -48,6 +50,13 @@ module Cryptum
|
|
48
50
|
left: 0
|
49
51
|
)
|
50
52
|
|
53
|
+
self.order_plan_details_section = Cryptum::UI.window(
|
54
|
+
height: 11,
|
55
|
+
width: 0,
|
56
|
+
top: 13,
|
57
|
+
left: 0
|
58
|
+
)
|
59
|
+
|
51
60
|
self.order_timer_section = Cryptum::UI.window(
|
52
61
|
height: 1,
|
53
62
|
width: 0,
|
@@ -76,6 +85,13 @@ module Cryptum
|
|
76
85
|
left: 0
|
77
86
|
)
|
78
87
|
|
88
|
+
self.order_execute_details_section = Cryptum::UI.window(
|
89
|
+
height: 11,
|
90
|
+
width: 0,
|
91
|
+
top: 29,
|
92
|
+
left: 0
|
93
|
+
)
|
94
|
+
|
79
95
|
self.command_section = Cryptum::UI.window(
|
80
96
|
height: 3,
|
81
97
|
width: 0,
|
data/lib/cryptum/ui.rb
CHANGED
@@ -12,10 +12,12 @@ module Cryptum
|
|
12
12
|
autoload :Ticker, 'cryptum/ui/ticker'
|
13
13
|
autoload :Portfolio, 'cryptum/ui/portfolio'
|
14
14
|
autoload :OrderPlan, 'cryptum/ui/order_plan'
|
15
|
+
autoload :OrderPlanDetails, 'cryptum/ui/order_plan_details'
|
15
16
|
autoload :OrderTimer, 'cryptum/ui/order_timer'
|
16
17
|
autoload :MarketTrend, 'cryptum/ui/market_trend'
|
17
18
|
autoload :SignalEngine, 'cryptum/ui/signal_engine'
|
18
19
|
autoload :OrderExecution, 'cryptum/ui/order_execution'
|
20
|
+
autoload :OrderExecuteDetails, 'cryptum/ui/order_execute_details'
|
19
21
|
autoload :Command, 'cryptum/ui/command'
|
20
22
|
|
21
23
|
# Initialize the UI
|
data/lib/cryptum/version.rb
CHANGED
@@ -185,10 +185,10 @@ module Cryptum
|
|
185
185
|
|
186
186
|
# Open / Close Order Plan / Order Execution Details Window
|
187
187
|
if terminal_win.key_press_event.key_enter
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
188
|
+
Cryptum::Event::Pane.toggle_details(
|
189
|
+
terminal_win: terminal_win,
|
190
|
+
event_history: event_history
|
191
|
+
)
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
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.
|
4
|
+
version: 0.0.267
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - '='
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 6.
|
159
|
+
version: 6.5.0
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - '='
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 6.
|
166
|
+
version: 6.5.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: require_all
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -402,6 +402,7 @@ files:
|
|
402
402
|
- lib/cryptum/order_book/market_trend.rb
|
403
403
|
- lib/cryptum/order_book/profit_margin.rb
|
404
404
|
- lib/cryptum/order_book/weighted_avg.rb
|
405
|
+
- lib/cryptum/order_execute_details.rb
|
405
406
|
- lib/cryptum/portfolio.rb
|
406
407
|
- lib/cryptum/portfolio/balance.rb
|
407
408
|
- lib/cryptum/ui.rb
|
@@ -410,6 +411,7 @@ files:
|
|
410
411
|
- lib/cryptum/ui/market_trend.rb
|
411
412
|
- lib/cryptum/ui/order_execution.rb
|
412
413
|
- lib/cryptum/ui/order_plan.rb
|
414
|
+
- lib/cryptum/ui/order_plan_details.rb
|
413
415
|
- lib/cryptum/ui/order_timer.rb
|
414
416
|
- lib/cryptum/ui/portfolio.rb
|
415
417
|
- lib/cryptum/ui/signal_engine.rb
|