Class: IB::OutgoingMessages::RequestHistoricalData
- Inherits:
-
AbstractMessage
- Object
- ExtremelyAbstractMessage
- AbstractMessage
- IB::OutgoingMessages::RequestHistoricalData
- Defined in:
- lib/ib-ruby/messages.rb
Constant Summary collapse
- BarSizes =
Enumeration of bar size types for convenience. These are passed to TWS as the (one-based!) index into the array. Bar sizes less than 30 seconds do not work for some securities.
[ :invalid, # zero is not a valid barsize :second, :five_seconds, :fifteen_seconds, :thirty_seconds, :minute, :two_minutes, :five_minutes, :fifteen_minutes, :thirty_minutes, :hour, :day, ]
Instance Attribute Summary
Attributes inherited from ExtremelyAbstractMessage
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from AbstractMessage
Methods inherited from ExtremelyAbstractMessage
Constructor Details
This class inherits a constructor from IB::OutgoingMessages::AbstractMessage
Class Method Details
.message_id ⇒ Object
620 621 622 |
# File 'lib/ib-ruby/messages.rb', line 620 def self. 20 end |
Instance Method Details
#queue(server) ⇒ Object
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 |
# File 'lib/ib-ruby/messages.rb', line 624 def queue(server) requireVersion(server, 16) if @data.has_key?(:what_to_show) && @data[:what_to_show].is_a?(String) @data[:what_to_show].downcase! @data[:what_to_show] = @data[:what_to_show].to_sym end raise ArgumentError("RequestHistoricalData: @data[:what_to_show] must be one of #{ALLOWED_HISTORICAL_TYPES.inspect}.") unless ALLOWED_HISTORICAL_TYPES.include?(@data[:what_to_show]) queue = [ self.class., 3, # version @data[:ticker_id] ] contract = @data[:contract].is_a?(Datatypes::Contract) ? @data[:contract] : Datatypes::Contract.from_ib_ruby(@data[:contract]) queue.concat(contract.serialize_long(server[:version])) queue.concat([ @data[:end_date_time], @data[:bar_size] ]) if server[:version] > 20 queue.concat([ @data[:duration], @data[:use_RTH], @data[:what_to_show].to_s.upcase ]) queue.push(@data[:format_date]) if server[:version] > 16 if contract.sec_type.upcase == "BAG" queue.concat(contract.serialize_combo_legs) end queue end |