Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IB API timeouts for large data requests #27

Open
cdcv opened this issue Jul 31, 2022 · 1 comment
Open

IB API timeouts for large data requests #27

cdcv opened this issue Jul 31, 2022 · 1 comment

Comments

@cdcv
Copy link

cdcv commented Jul 31, 2022

Is there a way to set a longer timeout interval for large data requests, or handle / avoid / correct api timeouts for large data requests?
In TWS, I tried changing the value of edit>Global Configuration>API>Settings>Timeout to send bulk data to API, but this did not seem to produce a change in behavior, the timeout is still generated at 30s after the request is submitted.

Why do you need large requests?
The API provides historical ADJUSTED_LAST data, apparently going back a long way. For example:
{contract: Contract.stock('GE'),duration: '10 Y', barSizeSetting: '1 hour', whatToShow: 'ADJUSTED_LAST', useRth: 1, formatDate: 1}
However, pulling a lot of data results in an api timeout.
I don't see a way to page the data because with the use of whatToShow: 'ADJUSTED_LAST', it is disallowed to use endDateTime to request the data in chunks. There are probably other circumstances where people need to make large data requests.

Is there a way to override the api timeout duration, or otherwise succeed in making a large data request?

Thank you

@cdcv
Copy link
Author

cdcv commented Jul 31, 2022

In client.js:

async _connect() {
if (this._protocolBytes) {
this._protocolBytes.removeAllListeners(); // allow gc to remove old
}

this._clientId = this._connectionParameters.clientId || 1;
this._serverVersion = 0;

// build protocol bytes object
this._protocolBytes = new ProtocolBytes();

const timeoutMs = this._connectionParameters.timeoutMs || 120000;

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

No branches or pull requests

1 participant