Module: Coinbot::UI::Status
- Defined in:
- lib/coinbot/ui/status.rb
Overview
This plugin is used to Refresh the Coinbot Status Section UI
Class Method Summary collapse
-
.help ⇒ Object
Display Usage for this Module.
-
.refresh(opts = {}) ⇒ Object
- Supported Method Parameters
-
Coinbot::UI::Status.refresh( indicator_status: 'required - Instatiated Coinbot::OrderBook::Indicators Object' ).
Class Method Details
.help ⇒ Object
Display Usage for this Module
111 112 113 114 115 116 117 |
# File 'lib/coinbot/ui/status.rb', line 111 public_class_method def self.help puts "USAGE: #{self}.refresh( indicator_status: 'required - Instatiated Coinbot::OrderBook::Indicators Object' ) " end |
.refresh(opts = {}) ⇒ Object
- Supported Method Parameters
-
Coinbot::UI::Status.refresh(
indicator_status: 'required - Instatiated Coinbot::OrderBook::Indicators Object')
14 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 |
# File 'lib/coinbot/ui/status.rb', line 14 public_class_method def self.refresh(opts = {}) status_win = opts[:status_win] key_press_event = opts[:key_press_event] indicator_status = opts[:indicator_status] indicator_type_hash = Coinbot::OrderBook.get_populated_indicators( indicator_status: indicator_status ) trend_indicator_arr = indicator_type_hash[:trend_indicator_arr] # health_indicator_arr = indicator_type_hash[:health_indicator_arr] Coinbot::UI.detect_key_press_in_ui( key_press_event: key_press_event, ui_win: status_win ) # ROW 1 out_line_no = 0 Coinbot::UI.line( ui_win: status_win, out_line_no: out_line_no ) out_line_no += 1 status_win.setpos(out_line_no, Coinbot::UI.col_first) status_win.clrtoeol Coinbot::UI.colorize( ui_win: status_win, color: :cyan, string: '* Trends >>> ' ) indicator_status_length = trend_indicator_arr.length indicator_index = 1 trend_indicator_arr.each do |is| status_indicator_color = is[:color] status_indicator_status = is[:status] Coinbot::UI.colorize( ui_win: status_win, color: status_indicator_color, string: status_indicator_status ) if indicator_index < indicator_status_length Coinbot::UI.colorize( ui_win: status_win, color: :white, string: ' | ' ) end indicator_index += 1 end # ROW 2 # out_line_no += 1 # status_win.setpos(out_line_no, Coinbot::UI.col_first) # status_win.clrtoeol # Coinbot::UI.colorize( # ui_win: status_win, # color: :cyan, # string: '* Health >>> ' # ) # indicator_status_length = health_indicator_arr.length # indicator_index = 1 # health_indicator_arr.each do |is| # status_indicator_color = is[:color] # status_indicator_status = is[:status] # Coinbot::UI.colorize( # ui_win: status_win, # color: status_indicator_color, # string: status_indicator_status # ) # if indicator_index < indicator_status_length # Coinbot::UI.colorize( # ui_win: status_win, # color: :white, # string: ' | ' # ) # end # indicator_index += 1 # end status_win.refresh rescue Interrupt # Exit Gracefully if CTRL+C is Pressed During Session Coinbot.exit_gracefully(which_self: self) rescue StandardError => e raise e end |