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
  • image.png

  • Posts

    • Recently, U.S. Senator Bill Hagerty from Tennessee spoke at the Bitcoin conference, stating his efforts to push for Bitcoin-supportive legislation to promote freedom and opportunity. This year, cryptocurrency has become a key battleground in the election campaigns. It remains to be seen whether future policies on cryptocurrency will improve.
    • The digital landscape is undergoing a profound transformation as attention, once a freely given commodity, is increasingly recognized as a valuable asset. Layer3 is at the forefront of this revolution, pioneering a new economy where attention can be owned, traded, and monetized   This innovative approach empowers individuals to monetize their engagement, providing unprecedented control over personal data. Simultaneously, advertisers benefit from transparent metrics that optimize campaign performance. Content creators are presented with diverse revenue avenues beyond traditional advertising, while the overall ecosystem experiences a more equitable distribution of value.   The implications of Layer3 extend across various sectors. Social media platforms, for instance, can leverage this technology to revolutionize user engagement and monetization strategies. Tokenomics play a crucial role in driving Layer3's economy, incentivizing participation and rewarding value creation. While challenges such as data privacy and market volatility exist, the potential benefits of Layer3 are immense   Anticipation is building as its native token $L3 is on Bitget Pre-market as users await its listing on the exchange. This milestone is expected to significantly increase the token's visibility and accessibility, potentially driving substantial growth and attracting new investors. As the countdown begins, the crypto community watches with keen interest, eager to see how Layer3 will perform in this new chapter.
    • I've been exploring the world of play-to-earn gaming recently, looking for something that's not just about endless grinding but actually offers a fun and rewarding experience. OGC really stood out to me because it combines gaming with a sense of community in a unique way. OGC isn't just a game; it's a platform where you can play, earn, and even help shape its future. You're not just a player; you're part of a community with a voice. The idea of earning crypto while playing games is exciting, but what makes OGC special is its focus on community involvement. Your feedback can directly influence the development of the game, which is a big deal. I've also heard that the OGC token is available for pre-market trading on Bitget. While I'm still getting to know the platform and its features, it's definitely something to keep an eye on. Has anyone else tried OGC? What has your experience been like? I'd love to hear your thoughts and any tips you might have.
×
×
  • Create New...
us