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, #update_missing

Instance Method Details

#==(other) ⇒ Object

Comparison



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

def == other
  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



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

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



53
54
55
56
57
# File 'lib/models/ib/execution.rb', line 53

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