Class: IB::Messages::Incoming::HistoricalData

Inherits:
Object
  • Object
show all
Defined in:
lib/ib/messages/incoming/historical_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resultsObject

Returns the value of attribute results.



31
32
33
# File 'lib/ib/messages/incoming/historical_data.rb', line 31

def results
  @results
end

Instance Method Details

#loadObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ib/messages/incoming/historical_data.rb', line 33

def load
  super

  @results = Array.new(@data[:count]) do |_|
    IB::Bar.new :time => socket.read_string,
                :open => socket.read_decimal,
                :high => socket.read_decimal,
                :low => socket.read_decimal,
                :close => socket.read_decimal,
                :volume => socket.read_int,
                :wap => socket.read_decimal,
                :has_gaps => socket.read_string,
                :trades => socket.read_int
  end
end

#to_humanObject



49
50
51
# File 'lib/ib/messages/incoming/historical_data.rb', line 49

def to_human
  "<HistoricalData: #{request_id}, #{count} items, #{start_date} to #{end_date}>"
end