lib/cryptum/ui/order_execute_details.rb in cryptum-0.0.270 vs lib/cryptum/ui/order_execute_details.rb in cryptum-0.0.271
- old
+ new
@@ -19,12 +19,61 @@
key_press_event = opts[:key_press_event]
order = event_history.order_execute_selected_data
tpm = order[:tpm]
autotrade_percent = order[:autotrade_percent]
- order_color = order[:color]
+ order_color = order[:color].to_sym
+ order_plan_no = order[:plan_no]
+ case order_color
+ when :cyan, :red
+ order_id = order[:buy_order_id]
+ order_type = 'Buy'
+ when :green, :magenta, :yellow
+ order_id = order[:sell_order_id]
+ order_type = 'Sell'
+ when :black
+ order_id = 'Expired'
+ order_type = 'Expired'
+ else
+ order_id = 'N/A'
+ order_type = 'N/A'
+ end
+
+ risk_alloc_out = Cryptum.beautify_large_number(
+ value: order[:risk_alloc]
+ )
+ invest_out = Cryptum.beautify_large_number(
+ value: order[:invest]
+ )
+ price_out = Cryptum.beautify_large_number(
+ value: order[:price]
+ )
+ size_out = Cryptum.beautify_large_number(
+ value: order[:size]
+ )
+ target_price_out = Cryptum.beautify_large_number(
+ value: order[:target_price]
+ )
+ profit_out = Cryptum.beautify_large_number(
+ value: order[:profit]
+ )
+ plan_no = "#{order[:plan_no]}|"
+
+ created_at = order[:created_at]
+
+ invest = "$#{invest_out} @ "
+ tick = "$#{price_out} = "
+ size = "*#{size_out} + "
+ tpm_out = "#{order[:tpm]}% = "
+ targ_tick = "$#{target_price_out}"
+ profit = "|Profit: $#{order[:profit]}"
+
+ order_id_details = "#{order_type} Order ID: #{order_id}"
+ order_plan_details = "Order Slice #: #{order_plan_no}"
+ order_exec_ln = "Details: #{created_at}|#{invest}#{tick}#{size}#{tpm_out}#{targ_tick}#{profit}"
+
# UI
col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
col_just4 = Curses.cols - Cryptum::UI.col_fourth
@@ -69,45 +118,38 @@
# ROW 3
out_line_no += 1
order_execute_details_win.setpos(out_line_no, Cryptum::UI.col_first)
order_execute_details_win.clrtoeol
- risk_alloc_out = Cryptum.beautify_large_number(
- value: order[:risk_alloc]
+ Cryptum::UI.colorize(
+ ui_win: order_execute_details_win,
+ color: order_color,
+ style: style,
+ string: order_id_details.ljust(col_just1, ' ')
)
- invest_out = Cryptum.beautify_large_number(
- value: order[:invest]
- )
- price_out = Cryptum.beautify_large_number(
- value: order[:price]
- )
- size_out = Cryptum.beautify_large_number(
- value: order[:size]
- )
- target_price_out = Cryptum.beautify_large_number(
- value: order[:target_price]
- )
- profit_out = Cryptum.beautify_large_number(
- value: order[:profit]
- )
- plan_no = "#{order[:plan_no]}|"
- created_at = order[:created_at]
+ # ROW 5
+ out_line_no += 1
+ order_execute_details_win.setpos(out_line_no, Cryptum::UI.col_first)
+ order_execute_details_win.clrtoeol
- invest = "$#{invest_out} @ "
- tick = "$#{price_out} = "
- size = "*#{size_out} + "
- tpm_out = "#{order[:tpm]}% = "
- targ_tick = "$#{target_price_out}"
- profit = "|Profit: $#{order[:profit]}"
+ Cryptum::UI.colorize(
+ ui_win: order_execute_details_win,
+ color: order_color,
+ style: style,
+ string: order_plan_details.ljust(col_just1, ' ')
+ )
- order_exec_ln = "#{created_at}|#{invest}#{tick}#{size}#{tpm_out}#{targ_tick}#{profit}"
+ # ROW 4
+ out_line_no += 1
+ order_execute_details_win.setpos(out_line_no, Cryptum::UI.col_first)
+ order_execute_details_win.clrtoeol
Cryptum::UI.colorize(
ui_win: order_execute_details_win,
color: order_color,
style: style,
- string: order_exec_ln.ljust(col_just1, '.')
+ string: order_exec_ln.ljust(col_just1, ' ')
)
# Clear to OK ROW
ok_row = 9
out_line_no += 1