cryptum 0.0.267 → 0.0.269
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 +10 -24
- data/lib/cryptum/event/history.rb +5 -1
- data/lib/cryptum/event/pane.rb +12 -26
- data/lib/cryptum/event.rb +41 -19
- data/lib/cryptum/ui/order_execute_details.rb +167 -0
- data/lib/cryptum/ui/order_execution.rb +8 -1
- data/lib/cryptum/ui/order_plan.rb +12 -5
- data/lib/cryptum/ui/order_plan_details.rb +112 -5
- data/lib/cryptum/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d40a387e6624886030d8bdaf44ffc1fe19d7d776810f6b369d4e0bc06f658b36
|
4
|
+
data.tar.gz: 26f2281e64fbfac162390bcc25be978e7e58498dd7fb4c6fa67e0e7c1d0f4e5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62511617e610526d54b285f2fb8ae2b450ed9042c382edfcb7eaea4e88b60ea346c7401ba5ecba563b12e48cfba63ac51c6cbdede6097c67d78abf0c672369d9
|
7
|
+
data.tar.gz: f31542bfaa39f3a6d8c16b0362285bfc9cd79f6f36deec22957c1774348660f4a8a4cc8d6981b6490970403e4032bec28e82bf470c5d28129934f4fb4dcc6164
|
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-05 19:21:30 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
|
@@ -41,13 +41,6 @@ Layout/EmptyLines:
|
|
41
41
|
Exclude:
|
42
42
|
- 'lib/cryptum/api.rb'
|
43
43
|
|
44
|
-
# Offense count: 1
|
45
|
-
# This cop supports safe autocorrection (--autocorrect).
|
46
|
-
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
47
|
-
Layout/ExtraSpacing:
|
48
|
-
Exclude:
|
49
|
-
- 'lib/cryptum/ui/order_plan.rb'
|
50
|
-
|
51
44
|
# Offense count: 1
|
52
45
|
# This cop supports safe autocorrection (--autocorrect).
|
53
46
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
@@ -82,14 +75,6 @@ Layout/MultilineOperationIndentation:
|
|
82
75
|
- 'lib/cryptum/ui/order_execution.rb'
|
83
76
|
- 'lib/cryptum/ui/ticker.rb'
|
84
77
|
|
85
|
-
# Offense count: 1
|
86
|
-
# This cop supports safe autocorrection (--autocorrect).
|
87
|
-
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
88
|
-
# SupportedStylesForExponentOperator: space, no_space
|
89
|
-
Layout/SpaceAroundOperators:
|
90
|
-
Exclude:
|
91
|
-
- 'lib/cryptum/ui/order_plan.rb'
|
92
|
-
|
93
78
|
# Offense count: 13
|
94
79
|
# This cop supports safe autocorrection (--autocorrect).
|
95
80
|
# Configuration parameters: AllowInHeredoc.
|
@@ -102,14 +87,14 @@ Layout/TrailingWhitespace:
|
|
102
87
|
- 'lib/cryptum/ui/order_plan.rb'
|
103
88
|
- 'lib/cryptum/ui/order_timer.rb'
|
104
89
|
|
105
|
-
# Offense count:
|
90
|
+
# Offense count: 84
|
106
91
|
Lint/UselessAssignment:
|
107
92
|
Enabled: false
|
108
93
|
|
109
|
-
# Offense count:
|
94
|
+
# Offense count: 48
|
110
95
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
111
96
|
Metrics/AbcSize:
|
112
|
-
Max:
|
97
|
+
Max: 405
|
113
98
|
|
114
99
|
# Offense count: 7
|
115
100
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
@@ -127,27 +112,28 @@ Metrics/BlockNesting:
|
|
127
112
|
Metrics/CyclomaticComplexity:
|
128
113
|
Max: 73
|
129
114
|
|
130
|
-
# Offense count:
|
115
|
+
# Offense count: 68
|
131
116
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
132
117
|
Metrics/MethodLength:
|
133
|
-
Max:
|
118
|
+
Max: 389
|
134
119
|
|
135
|
-
# Offense count:
|
120
|
+
# Offense count: 18
|
136
121
|
# Configuration parameters: CountComments, CountAsOne.
|
137
122
|
Metrics/ModuleLength:
|
138
123
|
Max: 538
|
139
124
|
|
140
|
-
# Offense count:
|
125
|
+
# Offense count: 19
|
141
126
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
142
127
|
Metrics/PerceivedComplexity:
|
143
128
|
Max: 76
|
144
129
|
|
145
|
-
# Offense count:
|
130
|
+
# Offense count: 3
|
146
131
|
# This cop supports safe autocorrection (--autocorrect).
|
147
132
|
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
148
133
|
# SupportedStyles: assign_to_condition, assign_inside_condition
|
149
134
|
Style/ConditionalAssignment:
|
150
135
|
Exclude:
|
136
|
+
- 'lib/cryptum/event/pane.rb'
|
151
137
|
- 'lib/cryptum/option.rb'
|
152
138
|
|
153
139
|
# Offense count: 1
|
@@ -29,11 +29,13 @@ module Cryptum
|
|
29
29
|
:order_plan_index_offset,
|
30
30
|
:order_plan_max_rows_to_display,
|
31
31
|
:order_plan_row_to_select,
|
32
|
+
:order_plan_selected_data,
|
32
33
|
:order_execute_win_active,
|
33
34
|
:order_execute_details_win_active,
|
34
35
|
:order_execute_index_offset,
|
35
36
|
:order_execute_max_rows_to_display,
|
36
|
-
:order_execute_row_to_select
|
37
|
+
:order_execute_row_to_select,
|
38
|
+
:order_execute_selected_data
|
37
39
|
|
38
40
|
def initialize(opts = {})
|
39
41
|
# option_choice = opts[:option_choice]
|
@@ -55,11 +57,13 @@ module Cryptum
|
|
55
57
|
self.order_plan_index_offset = 0
|
56
58
|
self.order_plan_max_rows_to_display = 6
|
57
59
|
self.order_plan_row_to_select = order_plan_index_offset
|
60
|
+
self.order_plan_selected_data = { color: :white }
|
58
61
|
self.order_execute_win_active = false
|
59
62
|
self.order_execute_details_win_active = false
|
60
63
|
self.order_execute_index_offset = 0
|
61
64
|
self.order_execute_max_rows_to_display = 6
|
62
65
|
self.order_execute_row_to_select = order_execute_index_offset
|
66
|
+
self.order_execute_selected_data = { color: :white }
|
63
67
|
|
64
68
|
# TODO: Implement market_trend_reset / 144
|
65
69
|
# Default = 10 minutes
|
data/lib/cryptum/event/pane.rb
CHANGED
@@ -34,32 +34,18 @@ module Cryptum
|
|
34
34
|
|
35
35
|
terminal_win.key_press_event.key_enter = false
|
36
36
|
|
37
|
-
if event_history.order_plan_win_active
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
elsif
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
37
|
+
if event_history.order_plan_win_active
|
38
|
+
if event_history.order_plan_details_win_active
|
39
|
+
event_history.order_plan_details_win_active = false
|
40
|
+
else
|
41
|
+
event_history.order_plan_details_win_active = true
|
42
|
+
end
|
43
|
+
elsif event_history.order_execute_win_active
|
44
|
+
if event_history.order_execute_details_win_active
|
45
|
+
event_history.order_execute_details_win_active = false
|
46
|
+
else
|
47
|
+
event_history.order_execute_details_win_active = true
|
48
|
+
end
|
63
49
|
end
|
64
50
|
rescue StandardError => e
|
65
51
|
raise e
|
data/lib/cryptum/event.rb
CHANGED
@@ -112,26 +112,48 @@ module Cryptum
|
|
112
112
|
fiat_portfolio_file: fiat_portfolio_file
|
113
113
|
)
|
114
114
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
115
|
+
unless event_history.order_plan_details_win_active
|
116
|
+
Cryptum::UI::OrderPlan.refresh(
|
117
|
+
option_choice: option_choice,
|
118
|
+
order_plan_win: terminal_win.order_plan_section,
|
119
|
+
event_history: event_history,
|
120
|
+
key_press_event: terminal_win.key_press_event,
|
121
|
+
indicator_status: indicator_status,
|
122
|
+
bot_conf: bot_conf,
|
123
|
+
fiat_portfolio_file: fiat_portfolio_file
|
124
|
+
)
|
125
|
+
end
|
124
126
|
|
125
|
-
event_history
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
127
|
+
if event_history.order_plan_details_win_active
|
128
|
+
Cryptum::UI::OrderPlanDetails.refresh(
|
129
|
+
option_choice: option_choice,
|
130
|
+
order_plan_details_win: terminal_win.order_plan_details_section,
|
131
|
+
event_history: event_history,
|
132
|
+
key_press_event: terminal_win.key_press_event
|
133
|
+
)
|
134
|
+
end
|
135
|
+
|
136
|
+
unless event_history.order_execute_details_win_active
|
137
|
+
event_history = Cryptum::UI::OrderExecution.refresh(
|
138
|
+
option_choice: option_choice,
|
139
|
+
order_execute_win: terminal_win.order_execute_section,
|
140
|
+
env: env,
|
141
|
+
event_history: event_history,
|
142
|
+
key_press_event: terminal_win.key_press_event,
|
143
|
+
indicator_status: indicator_status,
|
144
|
+
bot_conf: bot_conf,
|
145
|
+
fiat_portfolio_file: fiat_portfolio_file
|
146
|
+
)
|
147
|
+
end
|
148
|
+
|
149
|
+
if event_history.order_execute_details_win_active
|
150
|
+
Cryptum::UI::OrderExecuteDetails.refresh(
|
151
|
+
option_choice: option_choice,
|
152
|
+
order_execute_details_win: terminal_win.order_execute_details_section,
|
153
|
+
event_history: event_history,
|
154
|
+
key_press_event: terminal_win.key_press_event
|
155
|
+
)
|
156
|
+
end
|
135
157
|
|
136
158
|
# Refresh Command Section for Cryptum Session Usage
|
137
159
|
Cryptum::UI::Command.refresh(
|
@@ -0,0 +1,167 @@
|
|
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
|
+
order = event_history.order_execute_selected_data
|
22
|
+
tpm = order[:tpm]
|
23
|
+
autotrade_percent = order[:autotrade_percent]
|
24
|
+
order_color = order[:color]
|
25
|
+
|
26
|
+
# UI
|
27
|
+
col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
|
28
|
+
col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
29
|
+
col_just4 = Curses.cols - Cryptum::UI.col_fourth
|
30
|
+
|
31
|
+
# ROW 1
|
32
|
+
out_line_no = 0
|
33
|
+
line_color = order_color
|
34
|
+
header_color = order_color
|
35
|
+
header_style = :bold
|
36
|
+
style = :bold
|
37
|
+
header_style = :reverse if event_history.order_execute_details_win_active
|
38
|
+
|
39
|
+
Cryptum::UI.line(
|
40
|
+
ui_win: order_execute_details_win,
|
41
|
+
out_line_no: out_line_no,
|
42
|
+
color: line_color
|
43
|
+
)
|
44
|
+
|
45
|
+
# ROW 2
|
46
|
+
out_line_no += 1
|
47
|
+
order_execute_details_win.setpos(out_line_no, Cryptum::UI.col_first)
|
48
|
+
order_execute_details_win.clrtoeol
|
49
|
+
Cryptum::UI.colorize(
|
50
|
+
ui_win: order_execute_details_win,
|
51
|
+
color: header_color,
|
52
|
+
style: header_style,
|
53
|
+
string: ''.ljust(col_just1, ' ')
|
54
|
+
)
|
55
|
+
|
56
|
+
header_str = "- ##{order[:plan_no]} ORDER HISTORY DETAILS -"
|
57
|
+
order_execute_details_win.setpos(
|
58
|
+
out_line_no,
|
59
|
+
Cryptum::UI.col_center(str: header_str)
|
60
|
+
)
|
61
|
+
|
62
|
+
Cryptum::UI.colorize(
|
63
|
+
ui_win: order_execute_details_win,
|
64
|
+
color: order_color,
|
65
|
+
style: :bold,
|
66
|
+
string: header_str
|
67
|
+
)
|
68
|
+
|
69
|
+
# ROW 3
|
70
|
+
out_line_no += 1
|
71
|
+
order_execute_details_win.setpos(out_line_no, Cryptum::UI.col_first)
|
72
|
+
order_execute_details_win.clrtoeol
|
73
|
+
|
74
|
+
risk_alloc_out = Cryptum.beautify_large_number(
|
75
|
+
value: order[:risk_alloc]
|
76
|
+
)
|
77
|
+
invest_out = Cryptum.beautify_large_number(
|
78
|
+
value: order[:invest]
|
79
|
+
)
|
80
|
+
price_out = Cryptum.beautify_large_number(
|
81
|
+
value: order[:price]
|
82
|
+
)
|
83
|
+
size_out = Cryptum.beautify_large_number(
|
84
|
+
value: order[:size]
|
85
|
+
)
|
86
|
+
target_price_out = Cryptum.beautify_large_number(
|
87
|
+
value: order[:target_price]
|
88
|
+
)
|
89
|
+
profit_out = Cryptum.beautify_large_number(
|
90
|
+
value: order[:profit]
|
91
|
+
)
|
92
|
+
plan_no = "#{order[:plan_no]}|"
|
93
|
+
|
94
|
+
created_at = order[:created_at]
|
95
|
+
|
96
|
+
invest = "$#{invest_out} @ "
|
97
|
+
tick = "$#{price_out} = "
|
98
|
+
size = "*#{size_out} + "
|
99
|
+
tpm_out = "#{order[:tpm]}% = "
|
100
|
+
targ_tick = "$#{target_price_out}"
|
101
|
+
profit = "|Profit: $#{order[:profit]}"
|
102
|
+
|
103
|
+
order_exec_ln = "#{created_at}|#{invest}#{tick}#{size}#{tpm_out}#{targ_tick}#{profit}"
|
104
|
+
|
105
|
+
Cryptum::UI.colorize(
|
106
|
+
ui_win: order_execute_details_win,
|
107
|
+
color: order_color,
|
108
|
+
style: style,
|
109
|
+
string: order_exec_ln.ljust(col_just1, '.')
|
110
|
+
)
|
111
|
+
|
112
|
+
# Clear to OK ROW
|
113
|
+
ok_row = 9
|
114
|
+
out_line_no += 1
|
115
|
+
to_ok_row = ok_row - 1
|
116
|
+
(out_line_no..to_ok_row).each do |clr_line|
|
117
|
+
order_execute_details_win.setpos(clr_line, Cryptum::UI.col_first)
|
118
|
+
Cryptum::UI.colorize(
|
119
|
+
ui_win: order_execute_details_win,
|
120
|
+
color: order_color,
|
121
|
+
style: :normal,
|
122
|
+
string: ''.ljust(col_just1, ' ')
|
123
|
+
)
|
124
|
+
end
|
125
|
+
|
126
|
+
# OK ROW
|
127
|
+
out_line_no = ok_row
|
128
|
+
order_execute_details_win.setpos(out_line_no, Cryptum::UI.col_first)
|
129
|
+
order_execute_details_win.clrtoeol
|
130
|
+
Cryptum::UI.colorize(
|
131
|
+
ui_win: order_execute_details_win,
|
132
|
+
color: order_color,
|
133
|
+
string: ''.ljust(col_just1, ' ')
|
134
|
+
)
|
135
|
+
|
136
|
+
header_str = '- OK -'
|
137
|
+
order_execute_details_win.setpos(
|
138
|
+
out_line_no,
|
139
|
+
Cryptum::UI.col_center(str: header_str)
|
140
|
+
)
|
141
|
+
|
142
|
+
Cryptum::UI.colorize(
|
143
|
+
ui_win: order_execute_details_win,
|
144
|
+
color: order_color,
|
145
|
+
style: :reverse,
|
146
|
+
string: header_str
|
147
|
+
)
|
148
|
+
|
149
|
+
order_execute_details_win.refresh
|
150
|
+
rescue Interrupt
|
151
|
+
# Exit Gracefully if CTRL+C is Pressed During Session
|
152
|
+
Cryptum.exit_gracefully(which_self: self)
|
153
|
+
rescue StandardError => e
|
154
|
+
raise e
|
155
|
+
end
|
156
|
+
|
157
|
+
# Display Usage for this Module
|
158
|
+
|
159
|
+
public_class_method def self.help
|
160
|
+
puts "USAGE:
|
161
|
+
#{self}.refresh(
|
162
|
+
)
|
163
|
+
"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
@@ -421,12 +421,18 @@ module Cryptum
|
|
421
421
|
end
|
422
422
|
|
423
423
|
if order_history_meta.any?
|
424
|
+
selected_order = event_history.order_execute_selected_data
|
424
425
|
order_history_meta.reverse[first_row..last_row].each do |meta|
|
425
426
|
out_line_no += 1
|
426
427
|
current_line = out_line_no - 2
|
427
428
|
|
428
429
|
style = :normal
|
429
|
-
|
430
|
+
if event_history.order_execute_row_to_select == current_line
|
431
|
+
style = :highlight
|
432
|
+
selected_order = meta
|
433
|
+
selected_order[:color] = meta[:color]
|
434
|
+
end
|
435
|
+
|
430
436
|
risk_alloc_out = Cryptum.beautify_large_number(
|
431
437
|
value: meta[:risk_alloc]
|
432
438
|
)
|
@@ -476,6 +482,7 @@ module Cryptum
|
|
476
482
|
string: order_exec_ln.ljust(col_just1, '.')
|
477
483
|
)
|
478
484
|
end
|
485
|
+
event_history.order_execute_selected_data = selected_order
|
479
486
|
end
|
480
487
|
|
481
488
|
# ROW 10
|
@@ -321,12 +321,20 @@ module Cryptum
|
|
321
321
|
event_history.order_plan_index_offset = first_row
|
322
322
|
end
|
323
323
|
|
324
|
+
selected_order = event_history.order_plan_selected_data
|
324
325
|
order_plan[first_row..last_row].each do |order|
|
325
326
|
out_line_no += 1
|
326
327
|
current_line = out_line_no - 2
|
327
328
|
|
328
329
|
style = :normal
|
329
|
-
|
330
|
+
if event_history.order_plan_row_to_select == current_line
|
331
|
+
style = :highlight
|
332
|
+
selected_order = order
|
333
|
+
selected_order[:tpm] = tpm
|
334
|
+
selected_order[:autotrade_percent] = autotrade_percent
|
335
|
+
selected_order[:color] = plan_color
|
336
|
+
end
|
337
|
+
|
330
338
|
fiat_avail_out = Cryptum.beautify_large_number(
|
331
339
|
value: order[:fiat_available]
|
332
340
|
)
|
@@ -348,11 +356,11 @@ module Cryptum
|
|
348
356
|
alloc = "$#{risk_alloc_out} @ #{order[:allocation_percent]}% = "
|
349
357
|
invest = "$#{invest_out} + #{tpm_out}% = "
|
350
358
|
|
351
|
-
returns
|
359
|
+
returns = "$#{return_out}|"
|
352
360
|
profit = "Profit: $#{profit_out}"
|
353
361
|
|
354
362
|
order_plan_invest = "#{plan_no}#{fiat}#{alloc}#{invest}"
|
355
|
-
order_plan_return
|
363
|
+
order_plan_return = "#{returns}#{profit}"
|
356
364
|
|
357
365
|
order_plan_win.setpos(out_line_no, Cryptum::UI.col_first)
|
358
366
|
order_plan_win.clrtoeol
|
@@ -363,6 +371,7 @@ module Cryptum
|
|
363
371
|
string: "#{order_plan_invest}#{order_plan_return}".ljust(col_just1, '.')
|
364
372
|
)
|
365
373
|
end
|
374
|
+
event_history.order_plan_selected_data = selected_order
|
366
375
|
|
367
376
|
if order_plan.length < 9
|
368
377
|
lines_to_clear = 9 - order_plan.length
|
@@ -407,8 +416,6 @@ module Cryptum
|
|
407
416
|
)
|
408
417
|
|
409
418
|
order_plan_win.refresh
|
410
|
-
|
411
|
-
# event_history
|
412
419
|
rescue Interrupt
|
413
420
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
414
421
|
Cryptum.exit_gracefully(which_self: self)
|
@@ -18,21 +18,128 @@ module Cryptum
|
|
18
18
|
indicator_status = opts[:indicator_status]
|
19
19
|
key_press_event = opts[:key_press_event]
|
20
20
|
|
21
|
-
|
21
|
+
order = event_history.order_plan_selected_data
|
22
|
+
tpm = order[:tpm]
|
23
|
+
autotrade_percent = order[:autotrade_percent]
|
24
|
+
order_color = order[:color]
|
22
25
|
|
23
26
|
# UI
|
24
|
-
|
27
|
+
col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
|
28
|
+
col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
29
|
+
col_just4 = Curses.cols - Cryptum::UI.col_fourth
|
25
30
|
|
26
31
|
# ROW 1
|
27
|
-
# COLUMN 1
|
28
32
|
out_line_no = 0
|
33
|
+
line_color = order_color
|
34
|
+
header_color = order_color
|
35
|
+
header_style = :bold
|
36
|
+
style = :bold
|
37
|
+
header_style = :reverse if event_history.order_plan_details_win_active
|
38
|
+
|
39
|
+
Cryptum::UI.line(
|
40
|
+
ui_win: order_plan_details_win,
|
41
|
+
out_line_no: out_line_no,
|
42
|
+
color: line_color
|
43
|
+
)
|
44
|
+
|
45
|
+
# ROW 2
|
46
|
+
out_line_no += 1
|
29
47
|
order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
|
30
48
|
order_plan_details_win.clrtoeol
|
31
49
|
Cryptum::UI.colorize(
|
32
50
|
ui_win: order_plan_details_win,
|
33
|
-
color:
|
51
|
+
color: header_color,
|
52
|
+
style: header_style,
|
53
|
+
string: ''.ljust(col_just1, ' ')
|
54
|
+
)
|
55
|
+
|
56
|
+
header_str = "- ORDER SLICE ##{order[:plan_no]} DETAILS -"
|
57
|
+
order_plan_details_win.setpos(
|
58
|
+
out_line_no,
|
59
|
+
Cryptum::UI.col_center(str: header_str)
|
60
|
+
)
|
61
|
+
|
62
|
+
Cryptum::UI.colorize(
|
63
|
+
ui_win: order_plan_details_win,
|
64
|
+
color: order_color,
|
34
65
|
style: :bold,
|
35
|
-
string:
|
66
|
+
string: header_str
|
67
|
+
)
|
68
|
+
|
69
|
+
# ROW 3
|
70
|
+
out_line_no += 1
|
71
|
+
order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
|
72
|
+
order_plan_details_win.clrtoeol
|
73
|
+
|
74
|
+
fiat_avail_out = Cryptum.beautify_large_number(
|
75
|
+
value: order[:fiat_available]
|
76
|
+
)
|
77
|
+
risk_alloc_out = Cryptum.beautify_large_number(
|
78
|
+
value: order[:risk_alloc]
|
79
|
+
)
|
80
|
+
invest_out = Cryptum.beautify_large_number(
|
81
|
+
value: order[:invest]
|
82
|
+
)
|
83
|
+
profit_out = Cryptum.beautify_large_number(
|
84
|
+
value: order[:profit]
|
85
|
+
)
|
86
|
+
tpm_out = format('%0.2f', tpm)
|
87
|
+
return_out = Cryptum.beautify_large_number(
|
88
|
+
value: order[:return]
|
89
|
+
)
|
90
|
+
plan_no = "#{order[:plan_no]}|"
|
91
|
+
fiat = "#{autotrade_percent}% of $#{fiat_avail_out} = "
|
92
|
+
alloc = "$#{risk_alloc_out} @ #{order[:allocation_percent]}% = "
|
93
|
+
invest = "$#{invest_out} + #{tpm_out}% = "
|
94
|
+
|
95
|
+
returns = "$#{return_out}|"
|
96
|
+
profit = "Profit: $#{profit_out}"
|
97
|
+
|
98
|
+
order_plan_invest = "#{plan_no}#{fiat}#{alloc}#{invest}"
|
99
|
+
order_plan_return = "#{returns}#{profit}"
|
100
|
+
|
101
|
+
Cryptum::UI.colorize(
|
102
|
+
ui_win: order_plan_details_win,
|
103
|
+
color: order_color,
|
104
|
+
style: style,
|
105
|
+
string: "#{order_plan_invest}#{order_plan_return}".ljust(col_just1, '.')
|
106
|
+
)
|
107
|
+
|
108
|
+
# Clear to OK ROW
|
109
|
+
ok_row = 9
|
110
|
+
out_line_no += 1
|
111
|
+
to_ok_row = ok_row - 1
|
112
|
+
(out_line_no..to_ok_row).each do |clr_line|
|
113
|
+
order_plan_details_win.setpos(clr_line, Cryptum::UI.col_first)
|
114
|
+
Cryptum::UI.colorize(
|
115
|
+
ui_win: order_plan_details_win,
|
116
|
+
color: order_color,
|
117
|
+
style: :normal,
|
118
|
+
string: ''.ljust(col_just1, ' ')
|
119
|
+
)
|
120
|
+
end
|
121
|
+
|
122
|
+
# OK ROW
|
123
|
+
out_line_no = ok_row
|
124
|
+
order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
|
125
|
+
order_plan_details_win.clrtoeol
|
126
|
+
Cryptum::UI.colorize(
|
127
|
+
ui_win: order_plan_details_win,
|
128
|
+
color: order_color,
|
129
|
+
string: ''.ljust(col_just1, ' ')
|
130
|
+
)
|
131
|
+
|
132
|
+
header_str = '- OK -'
|
133
|
+
order_plan_details_win.setpos(
|
134
|
+
out_line_no,
|
135
|
+
Cryptum::UI.col_center(str: header_str)
|
136
|
+
)
|
137
|
+
|
138
|
+
Cryptum::UI.colorize(
|
139
|
+
ui_win: order_plan_details_win,
|
140
|
+
color: order_color,
|
141
|
+
style: :reverse,
|
142
|
+
string: header_str
|
36
143
|
)
|
37
144
|
|
38
145
|
order_plan_details_win.refresh
|
data/lib/cryptum/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.269
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
@@ -409,6 +409,7 @@ files:
|
|
409
409
|
- lib/cryptum/ui/command.rb
|
410
410
|
- lib/cryptum/ui/key_press_event.rb
|
411
411
|
- lib/cryptum/ui/market_trend.rb
|
412
|
+
- lib/cryptum/ui/order_execute_details.rb
|
412
413
|
- lib/cryptum/ui/order_execution.rb
|
413
414
|
- lib/cryptum/ui/order_plan.rb
|
414
415
|
- lib/cryptum/ui/order_plan_details.rb
|