Sha256: e56fb9b733277aa554d43af70d21dbb41744cef9da36a524d8b1b64c27b16ebd

Contents?: true

Size: 850 Bytes

Versions: 9

Compression:

Stored size: 850 Bytes

Contents

# frozen_string_literal: true

module Cryptum
  # This plugin is used to Write the Order Book from Memory
  # to File When the "w" Key is Pressed
  module Event
    module OrderBook
      # Supported Method Parameters::
      # Cryptum::Event::BotConf.write(
      # )
      public_class_method def self.write(opts = {})
        terminal_win = opts[:terminal_win]
        event_history = opts[:event_history]

        terminal_win.key_press_event.key_w = false
        order_book_file = event_history.order_book[:path]
        File.open(order_book_file, 'w') do |f|
          f.puts event_history.order_book.to_json
        end
      rescue StandardError => e
        raise e
      end

      # Display Usage for this Module
      public_class_method def self.help
        puts "USAGE:
          #{self}.write()
        "
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cryptum-0.0.271 lib/cryptum/event/order_book.rb
cryptum-0.0.270 lib/cryptum/event/order_book.rb
cryptum-0.0.269 lib/cryptum/event/order_book.rb
cryptum-0.0.268 lib/cryptum/event/order_book.rb
cryptum-0.0.267 lib/cryptum/event/order_book.rb
cryptum-0.0.266 lib/cryptum/event/order_book.rb
cryptum-0.0.265 lib/cryptum/event/order_book.rb
cryptum-0.0.264 lib/cryptum/event/order_book.rb
cryptum-0.0.263 lib/cryptum/event/order_book.rb