Class: IB::Execution

Inherits:
Model show all
Includes:
BaseProperties
Defined in:
lib/models/ib/execution.rb

Overview

This is IB Order execution report.

Instance Method Summary collapse

Methods included from BaseProperties

#content_attributes, #set_attribute_defaults, #update_missing

Instance Method Details

#==(other) ⇒ Object

Comparison



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/models/ib/execution.rb', line 42

def == other
  super(other) ||
    other.is_a?(self.class) &&
    perm_id == other.perm_id &&
    local_id == other.local_id && # ((p __LINE__)||true) &&
    client_id == other.client_id &&
    exec_id == other.exec_id &&
    time == other.time &&
    exchange == other.exchange &&
    order_ref == other.order_ref &&
    side == other.side
  # TODO: || compare all attributes!
end

#default_attributesObject



32
33
34
35
36
37
38
39
# File 'lib/models/ib/execution.rb', line 32

def default_attributes
  super.merge :local_id => 0,
    :client_id => 0,
    :quantity => 0,
    :price => 0,
    :perm_id => 0,
    :liquidation => false
end

#to_humanObject Also known as: to_s



56
57
58
59
60
# File 'lib/models/ib/execution.rb', line 56

def to_human
  "<Execution: #{time} #{side} #{quantity} at #{price} on #{exchange}, " +
    "cumulative #{cumulative_quantity} at #{average_price}, " +
    "ids #{local_id}/#{perm_id}/#{exec_id}>"
end