# frozen_string_literal: true module Cryptum # This plugin is used to Refresh the Cryptum console UI module UI module MarketTrend # Supported Method Parameters:: # Cryptum::UI::Candle.refresh( # order_book: 'required - Order Book Data Structure', # event: 'required - Event from Coinbase Web Socket' # ) public_class_method def self.refresh(opts = {}) market_trend_win = opts[:market_trend_win] event_history = opts[:event_history] event = opts[:event] indicator_status = opts[:indicator_status] indicator_hash = Cryptum::OrderBook::MarketTrend.status( event_history: event_history, event: event, indicator_status: indicator_status ) market_trend_color = indicator_hash[:color] market_trend_out = indicator_hash[:ui] # UI # ROW 1 out_line_no = 0 Cryptum::UI.line( ui_win: market_trend_win, out_line_no: out_line_no ) # ROW 2 out_line_no += 1 market_trend_win.setpos(out_line_no, Cryptum::UI.col_first) market_trend_win.clrtoeol market_trend_win.setpos( out_line_no, Cryptum::UI.col_center(str: market_trend_out) ) Cryptum::UI.colorize( ui_win: market_trend_win, color: market_trend_color, style: :bold, string: market_trend_out ) market_trend_win.refresh event_history rescue Interrupt # Exit Gracefully if CTRL+C is Pressed During Session Cryptum::UI::Exit.gracefully(event_history: event_history) rescue StandardError => e raise e end # Display Usage for this Module 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 end end end