Jump to content
  • 0

Separate program threads fail setting account after session creation (REST API)


JulianG

Question

I have a program that uses the REST API. It has a main routine and two threads (written in Python). The main routine and each of the two threads establish their own session using the API (POST /session), then set the account (PUT /session).

This has worked fine for months, but for the last few weeks there has been a problem. The first creation of a session and setting the account works as before. However, when the threads come to set their accounts, I get error 401 and message 'error.security.account-token-invalid'. This program goes straight from creating the session to setting the account and it uses the CST and X-SECURITY-TOKEN returned by the session creation when it sets the account. Creating the session itself returns code 200, which indicates success.

Nothing has changed in my program to cause this. The problem is intermittent and I can improve things by retrying after a few seconds, when it will sometimes work.

Does anyone know of any changes at the IG end that might be causing this? Are there any obvious workarounds. One reason for having the separate sessions for the threads was to avoid any possibility of interference between them. I don't know how necessary this is. However, the program worked before and, even if I have to change it, I'd like to know what is happening.

Thanks for any help or suggestions.

Julian

 

Link to comment

1 answer to this question

Recommended Posts

  • 0

I've had similar problems using the rest api on a demo account. I've been using it for around 18 months now. My experience is this: it all works fine for months, then something happens (maybe they update the software or something) then it all goes flakey, struggling to create a session, errors downloading historic data. This can continue for weeks until finally everything goes back to normal again. Based on my time with IG I would describe what you have experienced as normal behaviour for their rest API. It's a shame and is putting me off from going live to be honest.

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
  • General Statistics

    • Total Topics
      20,001
    • Total Posts
      87,981
    • Total Members
      69,072
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    nickpaine
    Joined 26/09/22 12:40
  • Posts

    • Friday’s fiscal plan unveiled by the UK government has scared off investors and as a result the pound is down heavily across the board. IGTV’s Jeremy Naylor explains that while sterling is off today’s lows, it has suffered breaks of support taking the pound down to levels not seen in decades against a basket of currencies.          
    • GBP/USD in 37-year lows, EUR/GBP 2-year highs and EUR/USD fresh 20-year lows GBP/USD slid to its 1985 low and EUR/GBP rallied to a 2-year high following the UK’s fiscal stimulus mini budget while EUR/USD slid to fresh 20-year lows amid Italian far right election outcome.    Axel Rudolph | Market Analyst, London | Publication date: Monday 26 September 2022  EUR/USD drops to new 20-year lows as US dollar scales fresh 2-decade high This year’s slide in EUR/USD has taken it to levels last seen in June 2002 amid the Federal Reserve's (Fed) aggressive monetary tightening policy with market participants expecting another 125-basis point (bp) rate hike over the next couple of meetings, following three consecutive monthly 75bp rate rises which drove the US dollar to two-decade highs. With Italy’s first far right party since Benito Mussolini’s National Fascist Party in the 1920’s on course to win Sunday’s election, the euro is further under pressure. EUR/USD slid by around 4% since last week to fresh 20-year lows, slightly below key support seen between the June 2000 and January 2001 highs and the September 2002 low at $0.9698 to $0.9593 by dropping close to the $0.955 mark. Below it beckons the September 2001 high at $0.9331. Minor resistance can be spotted at the June 2000 high at $0.9698 above which lurks more substantial resistance around the 6 September trough at $0.9865. See an FX opportunity?
    • Market data to trade on Tuesday: China output; US inflation With the dollar remaining so strong, IGTV’s Jeremy Naylor looks at two trend trades that seem to indicate that there is no let-up in direction. USD/CNH is looking likely to break the near-term resistance on expected soft industrial production data in China, then US durable goods is likely to underscore the downward direction of trade for EUR/USD.        
×
×
  • Create New...