Module: Cryptum::UI::Command
- Defined in:
- lib/cryptum/ui/command.rb
Overview
This plugin is used to Refresh the Cryptum Command Section UI
Class Method Summary collapse
-
.help ⇒ Object
Display Usage for this Module.
-
.refresh(opts = {}) ⇒ Object
- Supported Method Parameters
-
Cryptum::UI::Command.refresh( action_command_status: ‘required - Instatiated Cryptum::OrderBook::Probabilities Object’ ).
Class Method Details
.help ⇒ Object
Display Usage for this Module
305 306 307 308 309 310 311 |
# File 'lib/cryptum/ui/command.rb', line 305 public_class_method def self.help puts "USAGE: #{self}.refresh( command_status: 'required - Instatiated Cryptum::OrderBook::Probabilities Object' ) " end |
.refresh(opts = {}) ⇒ Object
- Supported Method Parameters
-
Cryptum::UI::Command.refresh(
action_command_status: 'required - Instatiated Cryptum::OrderBook::Probabilities Object'
)
13 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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/cryptum/ui/command.rb', line 13 public_class_method def self.refresh(opts = {}) command_win = opts[:command_win] key_press_event = opts[:key_press_event] key_press_event = Cryptum::UI.detect_key_press_in_ui( key_press_event: key_press_event, ui_win: command_win ) if key_press_event.key_c key_c_color = :cyan key_c_style = :reverse else key_c_color = :white key_c_style = :bold end if key_press_event.key_g key_g_color = :cyan key_g_style = :reverse else key_g_color = :white key_g_style = :bold end if key_press_event.key_r key_r_color = :cyan key_r_style = :reverse else key_r_color = :white key_r_style = :bold end if key_press_event.key_u key_u_color = :cyan key_u_style = :reverse else key_u_color = :white key_u_style = :bold end if key_press_event.key_w key_w_color = :cyan key_w_style = :reverse else key_w_color = :white key_w_style = :bold end if key_press_event.key_x key_x_color = :cyan key_x_style = :reverse else key_x_color = :white key_x_style = :bold end command_str_r2_arr = [ "* v#{Cryptum::VERSION} >>> ", '[', 'C', ']ancel Open Orders', ' | ', '[', 'G', ']TFO', ' | ', '[', 'r', ']eload bot conf' ] command_str_r3_arr = [ '[', 'u', ']pdate summary', ' | ', '[', 'w', ']rite order book', ' | ', 'e[', 'x', ']it' ] # ROW 1 out_line_no = 0 command_win.clrtoeol command_win.setpos( out_line_no, Cryptum::UI.col_center(str: command_str_r2_arr.join) ) # * v#{Cryptum::VERSION} >>> Cryptum::UI.colorize( ui_win: command_win, color: :yellow, style: :bold, string: command_str_r2_arr.first ) # [C]ancel Open Orders Cryptum::UI.colorize( ui_win: command_win, color: key_c_color, style: key_c_style, string: command_str_r2_arr[1] ) Cryptum::UI.colorize( ui_win: command_win, color: :yellow, style: key_c_style, string: command_str_r2_arr[2] ) Cryptum::UI.colorize( ui_win: command_win, color: key_c_color, style: key_c_style, string: command_str_r2_arr[3] ) # | Cryptum::UI.colorize( ui_win: command_win, color: :white, string: command_str_r2_arr[4] ) # [G]TFO Cryptum::UI.colorize( ui_win: command_win, color: key_g_color, style: key_g_style, string: command_str_r2_arr[5] ) Cryptum::UI.colorize( ui_win: command_win, color: :yellow, style: key_g_style, string: command_str_r2_arr[6] ) Cryptum::UI.colorize( ui_win: command_win, color: key_g_color, style: key_g_style, string: command_str_r2_arr[7] ) # | Cryptum::UI.colorize( ui_win: command_win, color: :white, string: command_str_r2_arr[8] ) # [r]eload bot conf Cryptum::UI.colorize( ui_win: command_win, color: key_r_color, style: key_r_style, string: command_str_r2_arr[9] ) Cryptum::UI.colorize( ui_win: command_win, color: :yellow, style: key_r_style, string: command_str_r2_arr[10] ) Cryptum::UI.colorize( ui_win: command_win, color: key_r_color, style: key_r_style, string: command_str_r2_arr.last ) # ROW 3 out_line_no += 1 command_win.setpos( out_line_no, Cryptum::UI.col_center(str: command_str_r3_arr.join) ) command_win.clrtoeol # [u]date summary Cryptum::UI.colorize( ui_win: command_win, color: key_u_color, style: key_u_style, string: command_str_r3_arr.first ) Cryptum::UI.colorize( ui_win: command_win, color: :yellow, style: key_u_style, string: command_str_r3_arr[1] ) Cryptum::UI.colorize( ui_win: command_win, color: key_u_color, style: key_u_style, string: command_str_r3_arr[2] ) # | Cryptum::UI.colorize( ui_win: command_win, color: :white, string: command_str_r3_arr[3] ) # [w]rite order book Cryptum::UI.colorize( ui_win: command_win, color: key_w_color, style: key_w_style, string: command_str_r3_arr[4] ) Cryptum::UI.colorize( ui_win: command_win, color: :yellow, style: key_w_style, string: command_str_r3_arr[5] ) Cryptum::UI.colorize( ui_win: command_win, color: key_w_color, style: key_w_style, string: command_str_r3_arr[6] ) # | Cryptum::UI.colorize( ui_win: command_win, color: :white, string: command_str_r3_arr[7] ) # e[x]it Cryptum::UI.colorize( ui_win: command_win, color: key_x_color, style: key_x_style, string: command_str_r3_arr[8] ) Cryptum::UI.colorize( ui_win: command_win, color: :yellow, style: key_x_style, string: command_str_r3_arr[9] ) Cryptum::UI.colorize( ui_win: command_win, color: key_x_color, style: key_x_style, string: command_str_r3_arr.last ) # ROW 4 out_line_no += 1 Cryptum::UI.line( ui_win: command_win, out_line_no: out_line_no ) command_win.refresh sleep 0.15 if key_press_event.key_g || key_press_event.key_r || key_press_event.key_u || key_press_event.key_w || key_press_event.key_x rescue Interrupt # Exit Gracefully if CTRL+C is Pressed During Session Cryptum.exit_gracefully(which_self: self) rescue StandardError => e raise e end |