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

#as_table, #content_attributes, #invariant_attributes, #set_attribute_defaults, #table_header, #table_row, #update_missing

Instance Method Details

#==(other) ⇒ Object

Comparison



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

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



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

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



58
59
60
61
62
# File 'lib/models/ib/execution.rb', line 58

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