Jump to content
  • 0

Lightstreamer Connect fail on DEMO account



I can't connect to the DEMO stream ("https://demo-apd.marketdatasystems.com") since December 2021 with a C# .NET application using the IG API
On the other hand the connection to a LIVE stream ("https://apd.marketdatasystems.com") works

It seems that the problem comes from the "DotNetClient_N2.dll" library.
Has anyone encountered the same problem ?


Edited by swingwin
Link to comment

Recommended Posts

  • 0

Hello Swingwin, I have the same problem with my own LabVIEW software which does not use the dotnet library from IG. After reading your message I tried my software on the DEMO stream and I see the same problem as you. (I rarely use the demo stream). Do you know what needs to be changed very concretely in the subscription procedure? I don’t program with C#. Everything is at the socket. Did you read somewhere a message from IG that informed about the modification of the parameters for the DEMO stream subscription requests? It scares me if one day they do the same with the PROD stream ahah. Anyway, it's nice to meet you again. We should stay in touch!

Link to comment
  • 0

Hello Tartempion, thanks for your answer and for your tests
It's also a pleasure to see you again.

I asked the support of IG France about this problem, but after consulting their technical service, they tell me that nothing has been changed on their side to access the DEMO stream.
The problem still exists despite the advice provided by Teebeast.
But I realize that the problem does not exist when using the IGLabs companion to access the stream.
The java example provided in IGLabs also works.
This problem is very disturbing.
Especially since I haven't changed anything in my apps for months, and everything was working fine until mid-December 2021.  



Link to comment
  • 0

I have changed the type to .net standard 2.0. That should let you load it with both 4.5 and .net core. Pull the latest and rebuild the project.

If you have any other issues with the library please log an issue on Github, I don't get notifications from this forum if I don't log in. Github will send me an email with your issue.

Link to comment
  • 0

Hi Swingwin (and other contributors),

I too had a similar problem with the DEMO stream, however my timings were different. I had no issues in December but started to get the same issues as you in early Jan. At the same time as I had connection issues with DEMO, the streaming companion on demo worked fine, and the same code DotNetClient_N2 connect to LIVE stream worked fine

There are other posts on the forum where others state it has happened to them, but during different periods. Given it seems to affect different people at different times, and those people seem to be using it then it suddenly stops for a while, I am beginning to wonder if this is down to the stated data limit.

40 concurrent subscriptions”.

I wonder if, when an application has the stream up and is killed during testing/debugging, does it leave the subscription count incremented? This would seem to explain why different people get it at different times. If then at some point the count is reset access comes back – which it seems to. And this would also explain why it mostly happens with DEMO. (I have had it happen on LIVE too when I have had to use LIVE when DEMO was not available)

A natural counter to this would be that if this is the case it should block the companion connection too. However, I used F12 dev tool on the browser to look at the mechanism for connecting the companion.

From what I can tell there is a slight difference in the login request headers in the PUT to /gateway/deal/session

The c# code I have adds X-IG-API-KEY and VERSION as default headers, and Content-Type as custom to that request particular, whereas the companion uses

      req.headers = {

            "X-IG-API-KEY": credentials.apiKey,

            "Content-Type": "application/json; charset=UTF-8",

            "Accept": "application/json; charset=UTF-8"


Not sure what “Accept” is doing.

Regards Tom

Link to comment
  • 0

Hi Tom,

Thanks for this, very detailed.  I've just tried lots of GO's on the streaming companion, actually 5 and had the error message.
"Login failed: 403 (Forbidden) error.public-api.exceeded-api-key-allowance"

So likely this is the cause.  Still not sure how a concurrent subscription happens with only one link.  I'll send this to IG.

  • Like 1
Link to comment
  • 0
On 08/02/2022 at 12:48, Funky_Gibbon said:

Hi Tom,

Thanks for this, very detailed.  I've just tried lots of GO's on the streaming companion, actually 5 and had the error message.
"Login failed: 403 (Forbidden) error.public-api.exceeded-api-key-allowance"

So likely this is the cause.  Still not sure how a concurrent subscription happens with only one link.  I'll send this to IG.

Hi Funky,

I was using the LS dot net Client dll. it supports calls to "connect" and "disconnect" which is pretty opaque. I did not/could not find the level of detail you found (error.public-api.exceeded-api-key-allowance) . It seems to confirm it, though am not sure how the streaming companion escapes this limit even though it uses the same API key and account

regards Tom 

Link to comment
  • 0

As the Teebeast fork does not fix the problem for me,
As I didn't test the Jlz solution,
As the java example works in LIVE and in DEMO,
As the IGlabs companion works LIVE and in DEMO,
As my application (few thousands lines of code) use C#.NET,
I will interface the JAVA lightstreamer library with C#.NET using the IKVM.NET tool.
I will specify here as soon as it works and fixes the problem.

Link to comment
  • 0


I'm also having problems connecting to LightStreamer DEMO. My code which used to work fine has recently stopped working. Everything is fine for PROD. Even the undocumented 'Heartbeat' function works. This is using the .Net client  DotNetClient_N2.dll.

I tried jlz / algoTrader's code (thanks) and got that working for PROD but again not for DEMO. This code uses the .Net Standard LightStreamer client v5.0.5 as I understand it.

So that's 2 different C# libraries not working for DEMO.

The IG Companion works fine, not had a single problem with that.

I've not yet had the time to delve into the HTTP headers, I used to use SOAP UI for that kind of deep dive so I don't know what error codes are being returned if any. Someone here posted about -

"Login failed: 403 (Forbidden) error.public-api.exceeded-api-key-allowance"

which seems plausible but I haven't diagnosed for so I can't verify. It wouldn't explain to me though why I can still use the IG Streaming Companion concurrently whilst the C# code fails. I could for example connect to LightStreamer DEMO in Brave browser (SUCCESS), then run my code (both client libraries FAIL) and then connect again to LightStreamer DEMO in Oprah browser (SUCCESS). Any permutation on this produces similar results.

It seems to me there is a difference between the PROD and DEMO server settings at IG's end. Is there anyway we can escalate? I really don't fancy developing against PROD or wrapping some kind of Java client.

Thanks for the help on this thread.


Link to comment
  • 0

Hi Charlie,

try to create a new API-Key for DEMO access. It seems that the Lightstream server has its own blocklist, independant from the REST server. Maybe this is a problem in your implementation. Or is a result of heavy debugging and testing.

Link to comment
  • 0


Thanks for the swift reply.

Surprise surprise I'm having difficulty creating a new DEMO API Key. The My IG website says there is a problem so I've contacted IG support and hopefully they can reset something. The fact that I'm having trouble doing this does tend to suggest they have taken steps to ensure their servers aren't overloaded which is what I've read in other community posts and is fair enough.

I'll keep you posted.

Link to comment
  • 0

Thanks Charlie for the detailed explanation.
It's exactly the same problems on my side
I also tried to create a new API DEMO key in the past, and had the same failure to create it.
Maybe by doing a deactivation/activation of the existing API key the problem will disappear, but I don't dare to do the manipulation because I'm afraid of a definitive deactivation of this key.

I am very interested in the feedback you will get from IG.

Link to comment
  • 0

So I've waited a few days now for a reply from IG (I received an automated one so I know they got my email which included a link to this thread) and so far none has been forthcoming. I'm not surprised if I'm being honest. I've got a feeling that from IG's point of view it is not really worth their time on the issue of DEMO API Keys.

I borrowed a DEMO API Key from a good friend who has had an account with IG for a few years now and had exactly the same problem. I could login from both a browser and from code but the Lightstreamer connection in code failed. I know my friend has not overly used the DEMO API Key for development as he is not a programmer so the problem is not due to overuse.

From reading other posts here on this thread the problem isn't due to using C# libraries, whether using the legacy library (DotNetClient_N2.dll) or the new .Net Standard one (v5.0.5 - which incidentally only seemed to achieve adding 350MB of libraries to my project).
@Tartempion mentioned using LabVIEW at the socket level and having the same problem.
@teebeast mentioned obtaining a new DEMO API Key because of a possible blocklist.

I can only guess that there is some issue at IG's end with DEMO API Keys that were issued sometime ago.
To be fair, I can understand why this is not a priority for IG. The return on investment is probably not worth it for the resources they would have to devote (skilled, knowledgeable personnel, time, money, etc). I guess that the number of retail clients that use the DEMO API and who are financially viable for IG is very, very low. They are probably more invested in their web, app, MetaTrader and ProRealTime platforms.
I actually see this as a positive as I believe in my ideas and skills and now speculate there aren't many doing what I am doing. It is a bit of a poor mark though as I feel as an engineer/programmer, you should know your kit inside out and top to bottom as best you can. Or, at least, reply with an email saying it is not IG's priority at this time to resolve the issue.

When I logged onto my friends demo account I noticed that he had trades that were well over a year old and still running (Buy Oil @ US$49!). As a suggestion to IG could they not completely reset/reboot the Demo environment every now and then, after giving advance warning to clients that all demo trades would be wiped?

I have decided to continue development of my software for the IG API. I have over a period of time compiled notes and so I am familiar with the implementation and some of its quirks. For example TRADE CONFIRMS on both the REST API and STREAM APIs isn't ideal. I will have to develop against PRODUCTION using my live account which is far from ideal but there are markets that have low margin requirements and price per points (eg the crypto EOS) so hopefully I won't lose money. I'm glad I am not developing from scratch.
I've decided though that in the future any new trading software I develop will be for MetaTrader 4. I only have a limited understanding of its API and I hear debugging is a pain. To many it would look like a step backwards but MetaTrader 4 has one great advantage in that I am not tied to any one broker. So if my account were locked or frozen I may have the option to move elsewhere. This is not intended as a criticism of IG who obviously want active clients but if you look at recent world events in say Canada or Russia, Governments can freeze bank accounts without due legal process or notice.

Onwards and upwards.


Link to comment
  • 0

So I had the same issue that my self-developed client simply would not connect to the API anymore; after checking out the LightStreamer API companion (it took some hours to remember that it exists) and examining the requests it makes it seems that the API was upgraded to 6.0, which require a little bit different session creation. But then it works with the demo account just fine, even with an old API key.

Link to comment
  • 0

Thanks for the reply. I've been going crazy as this weekend (Sat 14 May 2022) my LIVE LightStreamer API Key stopped working, though the API Companion website is still working.

Could you provide me with any more information?
What software did you use to diagnose the API Companion? POSTMAN? SOAPUI? Wireshark?
When you say version 6 - do you mean LightStreamer Server? I have been using from C# both the legacy client (DotNetClient_N2.dll) and the .Net Standard client v5.0.5. Is there a new client? v6?

Any more info would be appreciated. If I get it working I will post a detailed breakdown.



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

    • In the wake of a brewing conflict between the Nigerian government and Binance, cryptocurrency enthusiasts find themselves on edge, uncertain about the future of their digital investments. Rumors abound that Binance, along with other platforms, might be exacerbating the Naira's devaluation against the dollar, prompting the government to take a hard stance against the exchange. Despite longstanding allegations of wrongdoing, recent events have propelled the government to escalate its actions. The situation has escalated dramatically, with Binance's P2P platform disabled and a staggering $10 billion fine imposed for alleged illegal activities. This punitive measure, coupled with last year's $4.3 billion fine by the SEC, underscores the gravity of the situation. However, skepticism lingers regarding the astronomical sum demanded by the Nigerian government. While Binance has faced regulatory challenges in other jurisdictions, its resilience and market dominance have largely endured. Yet, the potential ramifications of losing access to a key crypto market like Nigeria cannot be ignored. Complicating matters further, the Nigerian House of Representatives has summoned Binance CEO Richard Teng, issuing a seven-day ultimatum for him to address allegations of terrorist financing and money laundering, among other charges. This development casts a shadow over the future prospects of Binance in the country. Amidst the uncertainty surrounding Binance's operations in Nigeria, users are scrambling to identify alternative platforms. While other centralized exchanges (CEX) remain operational within the country, the pressing question remains: which platform will emerge as the most dependable alternative should the situation worsen? https://punchng.com/reps-summon-binance-boss-over-alleged-terrorism-financing/
    • 2024 has been a good year for crypto traders with signs of a bullish market prevailing. For the first time in 3 years, we are witnessing BTC set a new ATH repeatedly. If you endured the prolonged bear market of the previous years, you deserve these gigantic green candles! In addition to BTC's incredible run, several alts have broken out nicely; Ai, memecoin, GameFi projects and so on have spiked. Most notably in the month of February is the run of CEX tokens. According to Foresight News, centralized exchange tokens boast of a widespread price spike in February, based on data from ICO Analytics. Standing tall amongst many is BGB with 62% increase, while ASD, BNB, and KCS witnessed gains of 45%, 33%, and 22% respectively. As a BGB holder myself who’s been holding since June 2023 at an average price of $0.45, it’s been an incredible journey. I’ve witnessed it smash its ATH over again, the latest coming in February when BGB set a new ATH of $1.15. Aside the juicy ROI, BGB usecases have been a flex for me, granting me access to exclusive events, like Launchpads where I’ve also managed mouth-watering gains from my participations. BNB had a remarkable run in the last bull cycle, sadly I missed out having sold mine for peanuts. If you said I’m stoked to right my wrong with BGB this time, you wouldn’t be far from the truth!  Which CEX token(s) are you keenly observing?
    • Look at the transaction log to see why, Most of the time it's because your stop loss is set too close. 
  • Create New...