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

Hi, Unfortunately my project uses .Net framework 4.5 and I can't attach this library as the error is telling me they're incompatible.
I've tried all sorts but not strong enough to understand the issue other than rewriting the using statements?

Any ideas?


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 have not made any progress with IKVM since 17 February.

With the LightStreamer .NET library, always the same problem: connection in LIVE OK but connection in DEMO impossible.

I tried @jlz solution, but same problem

Link to comment
  • 0

Which version of LightStreamer .NET library do you use? I tested the NuGet-Package Lightstreamer.DotNetStandard.Client version 5.0.5 and I had no problems with my demo account. Do not use any newer version because its not compatible with IG.

Link to comment
  • 0

I just rewrote my entire program to use IG.Csharp.Api.Client in WPF forms.  The whole thing is more stable than before with messages that show what's happening with the lightstreamer client.
Fascinating how it pauses from time to time. 

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

  • General Statistics

    • Total Topics
    • Total Posts
    • Total Members
    • Most Online
      10/06/21 10:53

    Newest Member
    Joined 04/07/22 14:09
  • Posts

    • Why do you not just show me what I'm allowed to trade? How do people plan investments when you need to trade something to find out you can't? 'instrument not tax wrapper enabled' is a pain. Is it all short EFTs? I can trade 'leveraged shares 3x Tesla ETP GBp' but not the short version of it. I can't use a service like that, it's dumb considering how easy it would be to code in an option to filter out what I can not trade. 
    • Euro Q3 2022 Technical Forecast: EUR/USD Carves Out Bullish Reversal Pattern, But Caution is Warranted Jul 3, 2022 | DailyFX Diego Colman, Market Analyst EURO PRICE ACTION IN BOTTOMING-OUT PHASE? The euro continued to lose ground against the U.S. dollar in the second quarter, extending the relentless decline that began just over a year ago. There are several factors behind the recent sell-off, but the most important have been the divergence in monetary policy between the Fed and the ECB, the fallout from the Ukraine war and negative market sentiment. In the past three months, EUR/USD marked a new multi-year low near 1.0350, a key technical zone that has acted as support on several occasions in late 2016 and early 2017, as shown in the weekly chart below. The pair probed this floor twice during Q2, first in May and then in June, although the bears were unable to create a lower low on the second test amid weakening downside pressure, a sign that prices may have bottomed out around those levels. Although the long-horizon bias remains bearish, there are some indications that the worst may be over in terms of losses for the common currency, at least in the near-term, creating an attractive set-up for traders who like to play "trend reversal" strategies. EUR/USD WEEKLY CHART Chart created using TradingView DOUBLE BOTTOM PATTERN IN PLAY FOR EUR/USD Zooming in on the daily chart, it appears that EUR/USD is carving out a double bottom, a bullish reversal technical formation that tends to develop near the nadir of a well-established downtrend while the overall market is volatile. The double bottom, which develops in the shape of a letter “W”, is composed of two consecutive and similar troughs, divided by an intermediate peak, the pattern’s neckline, where prices, after rallying off the first valley, encountered resistance before pivoting lower on its way to set the second low. In our case, the neckline sits near 1.0760/1.0785. Heading into the third quarter, the double bottom is nearing completion and confirmation, with EUR/USD advancing towards the neckline, a major resistance, the break of which could give a solid bullish signal. We are not there yet, but 1.0760/1.0785 can be considered the line in the sand, so to speak. Focusing on the outlook, if EUR/USD manages to punch through the neckline decisively on higher-than-usual volume, the upside momentum could strengthen, setting the stage for the pair to challenge trendline resistance near 1.1100, followed by 1.1195, the 38.2% Fibonacci retracement of the 2018/2022 decline. Many things will have to go right for this scenario to play out, but the bullish case should not be dismissed despite the pessimism towards the euro. On the flip side, if the euro stalls, resumes its descent and revisits the 2022 lows, the double bottom pattern would be invalidated, especially if prices breach the floor in question and make a new low. In the event of a sustained drop below 1.0350, all bets are off. There is no significant technical support underneath this area, so EUR/USD could be on its way to parity if 1.0350 is violated. EUR/USD DAILY CHART Chart created using TradingView
    • Euro Q3 2022 Forecast: Euro May Fall Anew as Debt Crisis Fears Dilute ECB Rate Hikes Jul 2, 2022 | DailyFX Ilya Spivak, Head Strategist, APAC The Euro has steadily depreciated against a basket of major currencies since Dec. 2020. Tellingly, that turning point coincided with topping gold prices and the start of a creep higher in Fed rate hike expectations. The US central bank had signaled it was done adding to Covid-inspired stimulus measures. Not surprisingly, the overt start of the Fed’s tightening effort in June 2021 marked the beginning of the deepest drop along this bearish trajectory. The markets reckoned the ultra-dovish ECB would not be as quick to follow the US lead as many other top central banks, pushing yield spreads against the Euro. EURO DOWNTREND STALLS AS ECB RATE HIKE BETS SURGE (WEEKLY CHART) Source: TradingView Then, in the second quarter of 2022, European officials finally signaled a readiness to act as regional CPI inflation roared to record highs. It would go on to hit an eye-watering rate of 8.1 percent in May. The Euro found a floor and began to inch upward as rate hike expectations began to be absorbed into prices. EURO DEBT CRISIS FEARS RETURN AS THE ECB PREPARES TO FIGHT RECORD-HIGH INFLATION Speculation culminated on June 9, as the ECB formally announced incoming interest rate hikes. The central bank previously said it would end bond purchases – a form of non-standard stimulus – in July. Less than a week later, an emergency meeting was scrambled and a mandate given to create a new tool against ‘fragmentation.’ That stopped the Euro’s ascent in its tracks. ECB tightening expectations revived worries about high levels of debt in some Eurozone economies. The spread between Italian and benchmark German 10-year government bond yields widened sharply to a two-year high of 242 basis points (bps) after June’s policy meeting. Managing ‘fragmentation’ – that is, diverging lending rates across Eurozone states – now seems like it will necessarily keep ECB tightening modest relative to global peers. That puts the single currency at an acute disadvantage, suggesting the downtrend is due to resume. FISCAL REFORM COULD UNCHAIN THE ECB, BUT IT’S PROBABLY NOT COMING SOON The kind of structural reforms needed to untie the ECB’s hands – creating a joint “Euro-bond” or finally slashing debt levels in southern Europe – seems distant at best, if only because the critical Franco-German push needed for progress is a tall order. Berlin and Paris are likely to be focused on other priorities. The war in Ukraine and its implications for regional geopolitical and economic stability – most pressingly, the challenge it poses for securing energy supply at a reasonable cost without reliance on Russia – are clearly front-of-mind. Disruption of trade with a key market in China amid that country’s Covid-driven lockdowns is another worry. A hamstrung administration in the Eurozone’s number-two economy complicates fiscal matters further. French President Emanuel Macron managed to win another term in office, but his coalition lost its majority in the legislature. This means that the fragile government will struggle to get anything big done in the next five years.
  • Create New...