Class: IB::Messages::Outgoing::RequestRealTimeBars

Inherits:
Object
  • Object
show all
Defined in:
lib/ib/messages/outgoing/bar_requests.rb

Instance Method Summary collapse

Instance Method Details

#encodeObject



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/ib/messages/outgoing/bar_requests.rb', line 57

def encode
  data_type, bar_size, contract = parse @data

  [super,
   contract.serialize_short(:primary_exchange),  # include primary exchange in request
   bar_size,
   data_type.to_s.upcase,
   @data[:use_rth] ,
	   ""   # not suported realtimebars option string
	  ]
end

#parse(data) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/ib/messages/outgoing/bar_requests.rb', line 49

def parse data
  data_type, bar_size, contract = super data

  size = data[:bar_size] || data[:size]
  bar_size = 5 #  only 5 sec bars are supported   --> for future use ::> size.to_i
  [data_type, bar_size, contract]
end