Module: Cryptum::UI::SignalEngine
- Defined in:
- lib/cryptum/ui/signal_engine.rb
Class Method Summary collapse
-
.help ⇒ Object
Display Usage for this Module.
-
.refresh(opts = {}) ⇒ Object
- Supported Method Parameters
-
Cryptum::UI::Candle.refresh( order_book: ‘required - Order Book Data Structure’, event: ‘required - Event from Coinbase Web Socket’ ).
Class Method Details
.help ⇒ Object
Display Usage for this Module
112 113 114 115 116 117 118 119 |
# File 'lib/cryptum/ui/signal_engine.rb', line 112 public_class_method def self.help puts "USAGE: #{self}.refresh( order_book: 'required - Order Book Data Structure', event: 'required - Event from Coinbase Web Socket' ) " end |
.refresh(opts = {}) ⇒ Object
- Supported Method Parameters
-
Cryptum::UI::Candle.refresh(
order_book: 'required - Order Book Data Structure', event: 'required - Event from Coinbase Web Socket')
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/cryptum/ui/signal_engine.rb', line 15 public_class_method def self.refresh(opts = {}) option_choice = opts[:option_choice] signal_engine_win = opts[:signal_engine_win] event_history = opts[:event_history] key_press_event = opts[:key_press_event] indicator_status = opts[:indicator_status] bot_conf = opts[:bot_conf] fiat_portfolio_file = opts[:fiat_portfolio_file] color = :white color = indicator_status.market_trend[:color] if indicator_status.market_trend indicator_status.last_action_signal = indicator_status.action_signal case color when :green signal_color = :green action_signal = :sell when :yellow signal_color = :yellow action_signal = :hold when :red signal_color = :cyan action_signal = :buy else signal_color = :white action_signal = :skip end action_signal_out = "SIGNAL >>> #{action_signal.to_s.upcase} <<< ENGINE" # TODO: Everything Above this Line Needs to be Indicators ^ # UI col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1 # col_just1 = 12 col_just2 = 14 col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1 col_just4 = Curses.cols - Cryptum::UI.col_fourth Cryptum::UI.detect_key_press_in_ui( key_press_event: key_press_event, ui_win: signal_engine_win ) # ROW 1 out_line_no = 0 Cryptum::UI.line( ui_win: signal_engine_win, out_line_no: out_line_no ) # ROW 2 out_line_no += 1 signal_engine_win.setpos(out_line_no, Cryptum::UI.col_first) signal_engine_win.clrtoeol Cryptum::UI.colorize( ui_win: signal_engine_win, color: signal_color, style: :reverse, string: ''.ljust(col_just1, ' ') ) signal_engine_win.setpos( out_line_no, Cryptum::UI.col_center(str: action_signal_out) ) Cryptum::UI.colorize( ui_win: signal_engine_win, color: signal_color, style: :reverse, string: action_signal_out ) signal_engine_win.setpos(out_line_no, Cryptum::UI.col_fourth) Cryptum::UI.colorize( ui_win: signal_engine_win, color: signal_color, style: :reverse, string: ''.ljust(col_just4, ' ') ) signal_engine_win.refresh indicator_status.action_signal = action_signal indicator_status rescue Interrupt # Exit Gracefully if CTRL+C is Pressed During Session Cryptum.exit_gracefully(which_self: self) rescue StandardError => e raise e end |