class IB::Messages::Outgoing::RequestHistoricalData
Messages
that request bar data have special processing of @data
Public Instance Methods
encode()
click to toggle source
Calls superclass method
IB::Messages::Outgoing::AbstractMessage#encode
# File lib/ib/messages/outgoing/bar_requests.rb, line 55 def encode data_type, bar_size, contract = parse @data [super, contract.serialize_long, bar_size, data_type.to_s.upcase, @data[:use_rth]] end
parse(data)
click to toggle source
Preprocessor for some data fields
# File lib/ib/messages/outgoing/bar_requests.rb, line 9 def parse data type = data[:data_type] || data[:what_to_show] data_type = DATA_TYPES.invert[type] || type unless DATA_TYPES.keys.include?(data_type) error ":data_type must be one of #{DATA_TYPES.inspect}", :args end #size = data[:bar_size] || data[:size] #bar_size = BAR_SIZES.invert[size] || size # unless BAR_SIZES.keys.include?(bar_size) # error ":bar_size must be one of #{BAR_SIZES.inspect}", :args # end contract = data[:contract].is_a?(IB::Contract) ? data[:contract] : IB::Contract.from_ib_ruby(data[:contract]) [data_type, nil, contract] end