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.



34
35
36
# File 'lib/ib/messages/incoming/historical_data.rb', line 34

def results
  @results
end

Instance Method Details

#loadObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ib/messages/incoming/historical_data.rb', line 37

def load
  super

  @results = Array.new(@data[:count]) do |_|
    IB::Bar.new :time => buffer.read_int_date, # conversion of epoche-time-integer to Dateime
																			 # requires format_date in request to be "2"
																			 # (outgoing/bar_requests # RequestHistoricalData#Encoding)
                :open => buffer.read_float,
                :high => buffer.read_float,
                :low => buffer.read_float,
                :close => buffer.read_float,
                :volume => buffer.read_int,
                :wap => buffer.read_float,   
#                        :has_gaps => buffer.read_string,  # only in ServerVersion  < 124
                :trades => buffer.read_int  
  end
end

#to_humanObject



55
56
57
# File 'lib/ib/messages/incoming/historical_data.rb', line 55

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