Changing reference timezones of price data

49 views
Skip to first unread message

Gini

unread,
Jun 30, 2016, 4:04:02 AM6/30/16
to IbPy Discuss

I would like to be able to get price data of a security with EST (New York) as the timezone. I am using an IB live account. I am using python 3.5 with the IBPy library. My problem is that when I modify the 3rd argument of reqHistoricalData which controls the timezone of the data, the prices I get back are exactly the same.


How to reproduce the problem:

  1. Create the contract to be queried by specifying contract.m_symbol = 'AUD', contract.m_secType = 'CASH', contract.m_exchange = 'IDEALPRO', contract.m_primaryExch = 'IDEALPRO', contract.m_currency = 'NZD'
  2. Using reqHistoricalData, get the daily opening price of the above contract with EST as the timezone for 23/6/2016.
  3. Now change the timezone by modifying the 3rd argument of reqHistoricalData to use JST as the timezone for 23/6/2016.
  4. Compare the opening prices from step 2 and 3
The prices should differ, but they do not. Using other timezones does not change the opening price. Is there some peculiarity for forex data that I am not aware of?

Appreciate any help.

Derek Tishler

unread,
Jul 2, 2016, 10:41:43 AM7/2/16
to IbPy Discuss
I would consider handling the TZ conversions manually. According to the documentation, the returnd TZ for historical data depends on:
"Intra-day bar sizes are relayed back in Local Time Zone, daily bar sizes and greater are relayed back in Exchange Time Zone."

I am unsure what is meant by the "optinal" tz option in reqHistoricalData, but I am unsure its use is implemented. Source:

Gini

unread,
Jul 3, 2016, 10:31:13 PM7/3/16
to IbPy Discuss
Dear Derek,

Thanks for the reply. The limitations you have highlighted on the timezones are interesting since reqHistoricalData 3rd argument claims to allow the user to modify the timezone. 

For examples of the 3rd argument, IBPy's version of reqHistoricalData is able to accept the following:
1. ""
2. "20160703 00:00:00"
3. "20160703 00:00:00 EST"

I've had a conversation with their API guys over the help chat, and they claim that on their end they are able to modify the timezone by changing this argument. It doesn't seem to work on my end though.

If somebody could confirm this tz option in reqHistoricalData is not implemented, I would be very grateful.

best regards

Gini

unread,
Jul 10, 2016, 11:05:44 PM7/10/16
to IbPy Discuss
Hi everyone, take a look at this answer from StackOverflow, seems to make sense.

Reply all
Reply to author
Forward
0 new messages