Class: IB::Bar

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

Overview

This is a single data point delivered by HistoricData or RealTimeBar messages. Instantiate with a Hash of attributes, to be auto-set via initialize in Model.

Instance Method Summary collapse

Methods included from BaseProperties

#content_attributes, #default_attributes, #update_missing

Instance Method Details

#==(other) ⇒ Object

Order comparison



23
24
25
26
27
28
29
30
31
32
# File 'lib/models/ib/bar.rb', line 23

def == other
  time == other.time &&
    open == other.open &&
    high == other.high &&
    low == other.low &&
    close == other.close &&
    wap == other.wap &&
    trades == other.trades &&
    volume == other.volume
end

#to_humanObject Also known as: to_s



34
35
36
37
# File 'lib/models/ib/bar.rb', line 34

def to_human
  "<Bar: #{time} wap #{wap} OHLC #{open} #{high} #{low} #{close} " +
    (trades ? "trades #{trades}" : "") + " vol #{volume} gaps #{has_gaps}>"
end