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
      23,600
    • Total Posts
      96,962
    • Total Members
      44,169
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    Jag
    Joined 03/12/23 16:16
  • Posts

    • Trade statistics of the 'Triangle 8th' system as of 12/03/2023 Gain: 102.00% Profit: 781.52 USD Funds: 1,400.18 USD Balance: 1,781.52 USD Beginning deposit: 1,000.00 USD Withdrawals: 0.00 USD Top-ups: 0.00 USD
    • Name of stock - Vox Royalty   Name of Stock Exchange - NASDAQ   Leverage or Share dealing - Leverage   Ticker - VOXR   Country of the stock - Usa   Market Cap - 100M
    • It is a best practice to buy dip and sell high but this strategy mostly doesn’t go as planned because you can’t predict the final bottom. Some traders BTD anticipating a potential pullback which mostly doesn’t happen and this force some into panic selling. DYOR is mostly advisable but some people fail to know which analysis they should focus more on. When deciding to hold a token for a long-term FA is very important and its cardinal point should be thoroughly scrutinized before making such a decision. These points include; Whitepaper, Road map, and Usecase. These points have a huge impact on deciding how long to hold a project and also booast your confidence in the project's bullish potential.  The first principle in this industry is “invest what you can afford to lose" though many neglect this principle as such when a project is going through a price correction they panic sell and sell at a huge lost. Most normal regret their decision later when they see the project back on track. Once you adhere to the first principle you hardly fall victim to panic sales. Note that it is mostly not advisable to hold meme tokens una less you are convinced because meme goes with the hype and finds it hard to retest its ATH once the hype is over.  Anyway what are your trading strategy and principles you adhere to most?
×
×
  • Create New...
us