Module: Cryptum::Event::Cancel

Defined in:
lib/cryptum/event/cancel.rb

Overview

This Module is used to Cancel Open Orders When the ā€œCā€ Key is Pressed

Class Method Summary collapse

Class Method Details

.helpObject

Display Usage for this Module



26
27
28
29
30
# File 'lib/cryptum/event/cancel.rb', line 26

public_class_method def self.help
  puts "USAGE:
    #{self}.open_orders()
  "
end

.open_orders(opts = {}) ⇒ Object

Supported Method Parameters

Cryptum::Event::Cancel.open_orders( )



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cryptum/event/cancel.rb', line 11

public_class_method def self.open_orders(opts = {})
  terminal_win = opts[:terminal_win]
  option_choice = opts[:option_choice]
  env = opts[:env]

  terminal_win.key_press_event.key_c = false
  Cryptum::API::Orders.cancel_all_open_orders(
    env: env,
    option_choice: option_choice
  )
rescue Interrupt, StandardError => e
  Cryptum::Log.append(level: :error, msg: e, which_self: self)
end