Jump to content
  • 0

API calls occasionally return ConnectionResetError10054


nickcamel

Question

This week the API has been very shaky for me.

The REST-API

  • login,
  • handshake for retrieving CST and X-SECURITY-TOKEN tokens

and the STREAMING API

  • subscribing

all work pretty decent.

However, other REST-API calls, e.g. 'positions', 'prices', 'watchlists', most of the time return a connection error:

Quote

Connection broken: ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)

Concurrent calls, say 1 in 50, returns an OK response. Concurrent = call, get connection broken response, wait, same call again, i.e. without any new logout / login routines.

I've tried with both live and demo account. Same behavior.

Funny enough, 'positions/otc' seem to work most of the time.

Anyone know what's up?

Edited by nickcamel
added working REST-API call
Link to comment

4 answers to this question

Recommended Posts

  • 1
On 07/07/2022 at 07:26, nickcamel said:

This week the API has been very shaky for me.

The REST-API

  • login,
  • handshake for retrieving CST and X-SECURITY-TOKEN tokens

and the STREAMING API

  • subscribing

all work pretty decent.

However, other REST-API calls, e.g. 'positions', 'prices', 'watchlists', most of the time return a connection error:

Concurrent calls, say 1 in 50, returns an OK response. Concurrent = call, get connection broken response, wait, same call again, i.e. without any new logout / login routines.

I've tried with both live and demo account. Same behavior.

Funny enough, 'positions/otc' seem to work most of the time.

Anyone know what's up?

Hi @nickcamel,

You can reach out to webapisupport@ig.com for assistance on API.  Send them as much information as possible, they will come back to you accordingly.

All the best - Arvin

  • Like 1
Link to comment
  • 0

I think I managed to figure it out and resolve this issue.

Previously (for years) I used to always send a body along with the request

Quote

 body={}
...
requests.request(method, url, headers=headers, json=body)

Even if the body was empty.

This doesn’t seem to be a stable solution any longer for unknown reasons, (first detected 2022-07-04).

That’s also, I believe, why the ‘position/otc’ – POST would work, because it would send a non-empty body (as required).

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...
us