Sha256: fc9ada7c0be9791631948fcd508502e8f849e372878bf8905c9a217e40b6d2a7

Contents?: true

Size: 1.99 KB

Versions: 69

Compression:

Stored size: 1.99 KB

Contents

# frozen_string_literal: true

module Cryptum
  # Cryptum::UI Module used for Presenting the
  # Cryptum Curses Interface
  module UI
    # Update the Cryptum MarketTrend Section 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, StandardError => e
        Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
      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

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
cryptum-0.0.466 lib/cryptum/ui/market_trend.rb
cryptum-0.0.465 lib/cryptum/ui/market_trend.rb
cryptum-0.0.464 lib/cryptum/ui/market_trend.rb
cryptum-0.0.463 lib/cryptum/ui/market_trend.rb
cryptum-0.0.462 lib/cryptum/ui/market_trend.rb
cryptum-0.0.461 lib/cryptum/ui/market_trend.rb
cryptum-0.0.460 lib/cryptum/ui/market_trend.rb
cryptum-0.0.459 lib/cryptum/ui/market_trend.rb
cryptum-0.0.458 lib/cryptum/ui/market_trend.rb
cryptum-0.0.457 lib/cryptum/ui/market_trend.rb
cryptum-0.0.456 lib/cryptum/ui/market_trend.rb
cryptum-0.0.455 lib/cryptum/ui/market_trend.rb
cryptum-0.0.454 lib/cryptum/ui/market_trend.rb
cryptum-0.0.453 lib/cryptum/ui/market_trend.rb
cryptum-0.0.452 lib/cryptum/ui/market_trend.rb
cryptum-0.0.451 lib/cryptum/ui/market_trend.rb
cryptum-0.0.450 lib/cryptum/ui/market_trend.rb
cryptum-0.0.449 lib/cryptum/ui/market_trend.rb
cryptum-0.0.448 lib/cryptum/ui/market_trend.rb
cryptum-0.0.447 lib/cryptum/ui/market_trend.rb