different lengbar

17 views
Skip to first unread message

Sir Zhang

unread,
May 30, 2016, 6:15:03 PM5/30/16
to IbPy Discuss
if i  reqHistoricalData more than once with different lengbar

like this:

# historicalData handler
con.register(myprintData, message.historicalData) 

# set different barLength
barLength='1 H'
con.reqHistoricalData(0,      
                          contract,
                          endDateTime,
                          '1 Y'
                          barLength,
                          'TRADES',
                          0, 1) 
  
time.sleep(1)  

# set different barLength
barLength='15 mins'
con.reqHistoricalData(0,      
                          contract,
                          endDateTime,
                          '1 Y'
                          barLength,
                          'TRADES',
                          0, 1) 


now my func myprintData will receive many data, 
how can  i know which is belong to 1 H or  15 mins?


Message has been deleted

Derek Tishler

unread,
May 31, 2016, 10:59:06 AM5/31/16
to IbPy Discuss

The first value of the function, in your case 0, is the id for identifying the messages from the server. You can parse the incoming data based on this value once you give each request a unique value.

And just for fun, in case you are wondering about historical data limits and a nice chart for pairing the allowed duration/granularity pairs,you can check here:
https://www.interactivebrokers.com/en/software/api/apiguide/tables/historical_data_limitations.htm
Reply all
Reply to author
Forward
0 new messages