Sha256: d2060ff9aae5ccc4a5ff50954fc0b14bf96d1eceb8794c9c466a906b9eb233eb

Contents?: true

Size: 1.53 KB

Versions: 30

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

module Cryptum
  # This plugin is used to Cancel Open Limit Orders
  module Event
    module Cancel
      # Supported Method Parameters::
      # Cryptum::Event::Cancel.open_orders(
      # )
      public_class_method def self.open_orders(opts = {})
        option_choice = opts[:option_choice]
        env = opts[:env]
        event_history = opts[:event_history]
        order_type = opts[:order_type]
        order_action = opts[:order_action]

        # Consume Latest Order History Justification from
        # Order Book & cancel orders tagged as pie
        # event_history = Cryptum::API.cancel_synced_oj_and_oh(
        #   option_choice: option_choice,
        #   env: env,
        #   event_history: event_history,
        #   order_type: order_type,
        #   order_action: order_action
        # )

        # event_history
        event_history.order_canceled = true
        event_history.event_notes = "{ \"event_type\": \"#{event_history.event_type}\", \"cancel\": \"#{event_history.order_canceled}\", \"submitted\": \"#{event_history.order_submitted}\" }" if option_choice.proxy

        Cryptum::API.cancel_all_open_orders(
          env: env,
          option_choice: option_choice,
          order_type: order_type,
          event_notes: event_history.event_notes
        )
      rescue StandardError => e
        raise e
      end

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

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
cryptum-0.0.262 lib/cryptum/event/cancel.rb
cryptum-0.0.261 lib/cryptum/event/cancel.rb
cryptum-0.0.260 lib/cryptum/event/cancel.rb
cryptum-0.0.259 lib/cryptum/event/cancel.rb
cryptum-0.0.258 lib/cryptum/event/cancel.rb
cryptum-0.0.257 lib/cryptum/event/cancel.rb
cryptum-0.0.256 lib/cryptum/event/cancel.rb
cryptum-0.0.255 lib/cryptum/event/cancel.rb
cryptum-0.0.254 lib/cryptum/event/cancel.rb
cryptum-0.0.253 lib/cryptum/event/cancel.rb
cryptum-0.0.252 lib/cryptum/event/cancel.rb
cryptum-0.0.251 lib/cryptum/event/cancel.rb
cryptum-0.0.250 lib/cryptum/event/cancel.rb
cryptum-0.0.249 lib/cryptum/event/cancel.rb
cryptum-0.0.248 lib/cryptum/event/cancel.rb
cryptum-0.0.247 lib/cryptum/event/cancel.rb
cryptum-0.0.246 lib/cryptum/event/cancel.rb
cryptum-0.0.245 lib/cryptum/event/cancel.rb
cryptum-0.0.244 lib/cryptum/event/cancel.rb
cryptum-0.0.243 lib/cryptum/event/cancel.rb