Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Timeouts on historical contract data #687

Open
8W9aG opened this issue Feb 1, 2024 · 1 comment
Open

Timeouts on historical contract data #687

8W9aG opened this issue Feb 1, 2024 · 1 comment

Comments

@8W9aG
Copy link

8W9aG commented Feb 1, 2024

I have a script that attempts to find the historical data for futures (lets say ZF), and in doing so loops through the contract months from 3 years ago to 3 years in the future, for example 202103, 202106, 202109.

An example of this call is like so:

bars = self._ibtw.reqHistoricalData(
    contract,
    endDateTime=dt,
    durationStr="10 D",
    barSizeSetting="1 min",
    whatToShow="TRADES",
    useRTH=True,
    formatDate=1,
    timeout=30.0,
)

Some of these result in a timeout (no matter what the value of the timeout is). Its reasonable that I receive no bars for my request having said that I suspect that if the contract month is not valid or too far in the past something gets lost and it just times out instead of giving me an empty bars result. Given I make a lot of these requests I would much prefer empty results rather than waiting for a timeout, its also hard for me to determine whether the timeout is valid in this case or whether the API doesn't want to give me the data.

@mattsta
Copy link
Contributor

mattsta commented Mar 4, 2024

I think this falls back on the regular disclaimer IBKR is not a reliable data provider.

For bulk data you'll want something more data oriented like polygon.io.

You are likely being cut off by IBKR's "pacing violations" logic: https://interactivebrokers.github.io/tws-api/historical_limitations.html

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants