Closed josefstr closed 7 years ago
For reqHistoricalTicks the latest TWS or gateway is required. If you already have that then try to qualify the contract before doing the request, like
ib.qualifyContracts(fdaxContract)
from your docs:
(version 967 or higher)
and I was running the latest stable 963. With the update to 967 I can request tick data. Thanks. Do you have plans to introduce some export possibilities for historical data, e.g. to csv?
Josef, saving to csv is a simple matter of converting to a DataFrame (for example with util.df) and then df.to_csv(...)
yep I've already found it.
another question:
looking at my results it seems that the most precise time is seconds:
HistoricalTickBidAsk(time=datetime.datetime(2017, 9, 1, 8, 1, 14)
but for tick data there should be 3 digits of micros available.
something like: M/d/yyyy HH:mm:ss.SSS
Unfortunately the data is sent with second resolution (unix time in seconds, as integer). This corresponds to the Time & Sales window in TWS.
Ewald,
Just a side note - when you reqHistoricalData for day bars (and longer) then the time field of bars in the callbacks is no longer epoch seconds time! It still a number, which represents YYYYMMDD. The new java api I use return "bar" object and behind the scene IP converts those YYYYMMDD back to epoch seconds (they become UTC midnight for daybars), so double-check what is returned in ib_insync case for day bars.
Cheers, Dmitry
Dmitry, the datetime parsing is handled here: https://github.com/erdewit/ib_insync/blob/9cf7bb4fd0dacca0ae2834ac60857deacbde0138/ib_insync/util.py#L307
It also handles the case for intraday bars that have been requested with formatDate=1.
I'm trying to request historical tick data:
I could request data with:
any idea what I'm doing wrong?