Skip to content

How to get Historical Data and Streaming? #22

Answered by topofocus
georgeu2000 asked this question in General
Discussion options

You must be logged in to vote

Hi,
you are right, documentation is mostly about EOD-Data.

Other timeframes are easily fetched by IB:Messages::Outgoing:RequestHistoricalData

The trading-system -gem extents the IB::Contract-class to fetch the data:

module IB
  class Contract
    def request_historic_data back: "10 D", interval: :hour1

       ib = Connection.current
       ib.send_message IB::Messages::Outgoing::RequestHistoricalData.new(
                      contract: self,
#                     end_date_time: Time.now.to_ib,  # set only if keep_up_todate is 0
                      duration: back, #    ?
                      bar_size: interval, #  IB::BAR_SIZES.key(:hour)?
                      what_to_show: :trades,

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@georgeu2000
Comment options

Answer selected by georgeu2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants