Sha256: 665940945aeedcb259e937bfe1ef6a3ede4fdf4f498102919465eaa3f6535e95

Contents?: true

Size: 1.94 KB

Versions: 3

Compression:

Stored size: 1.94 KB

Contents

# frozen_string_literal: true

module Cryptum
  # This plugin is used to Cancel Open Limit Orders
  module Event
    # Keep Last Event History When Terminal Resize Occuers
    class History
      attr_accessor :bullish_trend,
                    :event,
                    :event_notes,
                    :event_type,
                    :first_event,
                    :market_trend_event,
                    :order_book,
                    :order_canceled,
                    :order_submitted,
                    :order_ready,
                    :plan_no,
                    :reconnected,
                    :red_pill,
                    :reset_market_trend,
                    :start_time,
                    :ticker_event,
                    :time_between_orders,
                    :time_between_orders_max,
                    :time_between_orders_min,
                    :time_between_orders_reset

      def initialize(opts = {})
        # option_choice = opts[:option_choice]
        start_time = opts[:start_time]
        order_book = opts[:order_book]

        self.bullish_trend = true
        self.first_event = true
        self.order_canceled = false
        self.order_submitted = false
        self.order_ready = false
        self.order_book = order_book
        self.plan_no = 0
        self.start_time = start_time
        self.reconnected = false
        self.red_pill = false
        self.reset_market_trend = false

        # 10 minutes
        self.time_between_orders = 600
        self.time_between_orders_reset = self.time_between_orders

        # 24 hours
        self.time_between_orders_max = self.time_between_orders_reset * 144

        # 5 seconds
        self.time_between_orders_min = 5
      end
    rescue Interrupt
      # Exit Gracefully if CTRL+C is Pressed During Session
      Cryptum.exit_gracefully(which_self: self)
    rescue StandardError => e
      # Produce a Stacktrace for anything else
      raise e
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cryptum-0.0.254 lib/cryptum/event/history.rb
cryptum-0.0.253 lib/cryptum/event/history.rb
cryptum-0.0.252 lib/cryptum/event/history.rb