Jump to content
  • 0

Lightstreamer Connect fail on DEMO account


swingwin

Question

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

Many thanks @Tartempion.
In any case it is not won with Windows 7.
Because I don't see how to introduce this new property and how to install the TLS12 protocol
I did some tests today on my C# application but without success.

Link to comment
  • 0

For .NET applications the problem is clearly located in the .NET Framework and the way the TLS1.2 protocol is set up in it
So it is certainly not a problem linked to the "DotNetClient_N2.dll" library
Indeed :
- I made a test with the java application using the java library "sdk.client.java.se-5.1.1.1623.2.jar" ==> no connection problem and the data arrive correctly with the stream
- I converted this java library to .NET assembly using IKVMC
- my C#.NET application now uses the "sdk.client.java.se-5.1.1.1623.2.dll" library for lightstreamer connections, instead of the "DotNetClient_N2.dll" library
and then the lightstream connection fails with the following error message

"com.lightstreamer.ls_client.PushConnException: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake"

Link to comment
  • 0

You will need to install a fresh, clean copy of Windows 10 and then everything will work again.
Windows 10 has the underlying HTTPS SSL infrastructure needed for your code.
Other apps, like browsers, build their own HTTPS SSL infrastructure.
It is not possible to patch Windows 7, you are forced to upgrade or use a different code paradigm, like Java.
Note, installing Windows 10 over Windows 7 won't work as it keeps a lot of Windows 7 files, has to be a fresh, clean install of WIndows 10.

Link to comment
  • 0

For now, I solved my problem so I can stay with windows 7 and keep my C# application intact.

I developed a DDE server in Python interfacing with the IG APIs.
I converted the Python application into an executable to improve performance.
And I retrieve the DDE in C# (or Excel) with the NDde.dll assembly.

I'll leave it at that for now and wait to test fast feeds in times of high volatility
But if the performance is not there I'm considering doing the same thing with an RTD server and/or with Java.

Link to comment
  • 0

I have completed the performance tests in periods of high volatility (US opening for example).
The performances are excellent even if the solution found is a bit twisted.

So I stay on this technical solution which works perfectly with Windows 7 and .NET.
The solution is :
API stream received by a compiled python application, which delivers the data on the workstation with a DDE server.
Thus any application can connect to this DDE server and exploit the stream of the IG APIs (personal application with .NET, Excel, Matlab, etc...). No latency was observed.

Link to comment
  • 0

Has anyone used this Lightstreamer Haxe library in .NET version?
https://github.com/Lightstreamer/Lightstreamer-lib-client-haxe/tree/NET-v6.0.0-beta.2

Does it solve the problem mentioned in this thread?

The Haxe library is compatible with Lightstreamer Server since 7.3.2.
But is it the case for the LightStreamer IG server because IG still hasn't given the version used on their servers?
Sincerely

Link to comment
  • 0

I've tested it shortly with my project, but it's not running.

The problem with newer versions than 5.0.5 was, that the LS_CID has changed and was not accepted from server anymore. So I think that IG uses an older version of Lightstream Server. The LS_CID seems to be used to keep compatibility between client library and server.

Quote

LS_cid=jqWtj1twChtfDxikwp1ltvcC4BJ4KikvD578vy1sj.h67EK8MCb

Here my log:

Quote

serverAddress changed: https://demo-apd.marketdatasystems.com
event: nr:serverAddress.changed <m=100 du=20 nr=1400>
adapterSet changed: null
user changed: xxxxx
password changed
Connection requested: details: {serverAddress => https://demo-apd.marketdatasystems.com, user => xxxxx, libVersion => dotnet_standard_client 6.0.0-beta.2 build 20230405} options: {keepaliveInterval => 0, serverInstanceAddressIgnored => false, firstRetryMaxDelay => 100, contentLength => 50000000, sessionRecoveryTimeout => 15000, pollingInterval => 0, idleTimeout => 19000, slowingEnabled => false, requestedMaxBandwidth => BWUnlimited, stalledTimeout => 2000, reverseHeartbeatInterval => 0, HTTPExtraHeadersOnSessionCreationOnly => false, retryDelay => 4000, reconnectTimeout => 3000}
event: connect <m=100 du=20 nr=1400>
goto: <m=101 du=20 nr=1400>
goto: <m=101 du=20 nr=1410>
event: select.create <m=101 du=20 nr=1410>
Status: CONNECTING
WS connecting: wss://demo-apd.marketdatasystems.com/lightstreamer headers(null) proxy(null) certificateValidator(false)
goto: <m=120 du=20 nr=1410>
event: du:create <m=120 du=20 nr=1410>
goto: <m=120 du=21 nr=1410>
Subscription requested: subId: 1 {requestedSnapshot => SnpYes, mode => MERGE, items => [MARKET:IX.D.DAX.IFMM.IP], fields => [BID,OFFER]}
sub#subscribe(1) in <m=1>
sub#goto(1) <m=2>
event: send.control <m=120 du=21 nr=1410>
WS event: open
event: ws.open <m=120 du=21 nr=1410>
Sending session create: LS_user=xxxxx LS_cid=xxxxx LS_send_sync=false LS_cause=api
WS sending: wsok
WS sending: create_session
LS_user=xxxxx&LS_cid=xxxxx&LS_send_sync=false&LS_cause=api&LS_password=CST-xxxxx
goto: <m=121 du=21 nr=1410>
event: transport.timeout <m=121 du=21 nr=1410>
Websocket suspended
WS disposing
goto: <m=115 du=21 nr=1410>
event: du:retry <m=115 du=21 nr=1410>
Retrying connection. Cause: Websocket transport not available
goto: <m=115 du=23 nr=1410>
event: retry.timeout <m=115 du=23 nr=1410>
goto: <m=116 du=23 nr=1410>
event: select.create <m=116 du=23 nr=1410>
Sending session create: LS_polling=true LS_polling_millis=0 LS_idle_millis=0 LS_user=Z43B2S LS_cid=xxxxx LS_cause=ws.unavailable
HTTP sending: https://demo-apd.marketdatasystems.com/lightstreamer/create_session.txt?LS_protocol=TLCP-2.4.0 LS_polling=true&LS_polling_millis=0&LS_idle_millis=0&LS_user=xxxxx&LS_cid=xxxxx&LS_cause=ws.unavailable&LS_password=CST-xxxxx headers(null)
goto: <m=130 du=23 nr=1410>
event: du:create <m=130 du=23 nr=1410>
goto: <m=130 du=21 nr=1410>
HTTP event: text(CONERR,65,Unsupported protocol version: com.lightstreamer.b.b1@51dd3b73)
HTTP event: complete
event: CONERR <m=130 du=21 nr=1410>
CONERR 65 Unsupported protocol version: com.lightstreamer.b.b1@51dd3b73
HTTP disposing
Status: DISCONNECTED
goto: <m=100 du=21 nr=1410>
event: du:terminate <m=100 du=21 nr=1410>
Disconnected. Cause: 65 - Unsupported protocol version: com.lightstreamer.b.b1@51dd3b73
Transports enabled again.
goto: <m=100 du=20 nr=1410>
goto: <m=100 du=20 nr=1400>

 

Link to comment
  • 0
On 16/05/2022 at 05:03, mf2 said:

FWIW, the programming language does not really matter and you don’t need any special libraries to access the LightStreamer API. You can send standard HTTP requests and it works, as long as you stick to the protocol. Personally, I prefer this approach as this makes my program independent from any third-party libraries.

Regarding version 6.0, I meant that the LightStreamer API Companion adds `LS_client_version=6.0` to the request. Note that you don’t need any JavaScript client libraries to access the API via JavaScript, you could use AJAX and/or the .txt endpoint instead of the .js endpoint.

The issue is just that some details in the specification are left to speculation or interpretation, therefore it requires some experimenting. Furthermore, you need to make sure that you process Chunked requests properly if you don’t use polling.

Session V3 authentication can be used in your program, you just have to issue another Session V1 REST Api call afterwards to retrieve the CST and XST tokens, as you observed. Also, the documentation is here, you just need to scroll down to V3: https://labs.ig.com/rest-trading-api-reference/service-detail?id=600

(Note that IG calls this "oauth", but its really not)

So here is what I am doing:

  1. Authenticate with the REST api via a V3 session call
  2. Issue a V1 session call to get the XST and CST token
  3. Send the following HTTP POST request to the lightstreamer server, at `/lightstreamer/create_session.txt`:

"LS_cause=new.api&LS_polling=true&LS_polling_millis=0&LS_idle_millis=0&LS_client_version=6.0&LS_user=<IG Account ID>&LS_password=CST-<CST-Token>|XST-<XST-Token>&LS_container=lsc&"

Some notes:

  1. I use polling, which is not recommended, but its fine for my case.
  2. The `|` in the password needs to be escaped properly.

Hi Mf2, would you mind sharing part of your code that connects and handles the IG streaming connection? 🙂

 

Link to comment
  • 0

@SergioLage Interestingly, it seems that there is no proper way to post code in this forum – neither as a listing (no appropriate formatting) nor as an attachment (the filetype is not accepted).

So here is a very minimal C example, which gets you a working connection: http://0x0.st/H_rX.c

Note however, to subscribe to order status etc. you need to supply the other parameters like LS_user etc. which I wrote in my other post about.

 

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

    • Wheat Elliott Wave Analysis Function - Trend Mode - Trend Structure -Impulse wave Position - Wave A of (B) Direction - Wave A of (B) is still in play Details -  Wheat daily and H4 have been adjusted due to how fast and deep decline from 720’4 has emerged. The long-term forecast on the daily chart shows that the surge to 720’4 is part of the impulse wave from March 2022. We are now in wave (5) which is expected to emerge into a 3-wave structure. Price now appears to be in wave A after which it will correct upside for B before returning downside. Overview: Since late May, grain prices have been falling sharply, with Wheat shedding over 20% since May 28th, 2024. This decline is about to erase the gains made from mid-April to late May. The nearly one-month sell-off adds to the long-term decline from March 2022, when Wheat traded at 1364’4. Currently trading at 571’4, Wheat is likely to fall further toward 500 in the coming weeks.   Daily Chart Analysis: The decline from March 2022 is forming a bearish impulse wave structure in the primary degree. The 5th wave is completing a diagonal structure, which has been the most time-consuming among the actionary waves, lasting nearly 21 months. The price is currently in wave (5) of 5 (circled), which will likely evolve into a 3-wave structure targeting the 500 major psychological level.   H4 Chart Analysis: The H4 chart shows the sub-waves of wave (5), which is now close to completing its first leg - wave A of (5). A corrective bounce is expected to follow for wave B before the price turns downside for wave C of (5) toward 500, provided the 720’4 pivot is not breached. Wheat and other grains are overwhelmingly bearish and may continue in this direction for the next several weeks before major bullish corrections begin.   In conclusion, Wheat prices remain bearish with potential for further declines, targeting the 500 psychological level, contingent on the completion of the current corrective wave B and the subsequent wave C of (5). Technical Analyst : Sanmi Adeagbo Source : Tradinglounge.com get trial here!  
    • Dear @Naren12166, Thank you for the post. Please note that we don't have a definite date but the product team is in the testing phase, a few countries should have Trading View soon. Thanks, KoketsoIG
    • TXN Elliott Wave Analysis Trading Lounge Daily Chart, Texas Instruments Inc., (TXN) Daily Chart TXN Elliott Wave Technical Analysis FUNCTION: Counter Trend MODE: Corrective STRUCTURE: Triangle POSITION: Wave {iv}. DIRECTION: Bottom in wave {iv}.   DETAILS: Looking for a triangle in wave {iv} of 3 as we have found resistance on TL2 at 200$.     TXN Elliott Wave Analysis Trading Lounge 4Hr Chart, Texas Instruments Inc., ( TXN) 4Hr Chart TXN Elliott Wave Technical Analysis FUNCTION: Counter Trend MODE: Corrective STRUCTURE: Triangle POSITION: Wave (e) of {iv}. DIRECTION: Bottom in (e).   DETAILS: Looking for wave (e) to be near completion to then resume higher and find support on top of 200$.   Welcome to our latest Elliott Wave analysis for Texas Instruments Inc. (TXN). This analysis provides an in-depth look at TXN's price movements using the Elliott Wave Theory, helping traders identify potential opportunities based on current trends and market structure. We will cover insights from both the daily and 4-hour charts to offer a comprehensive perspective on TXN's market behavior.   * TXN Elliott Wave Technical Analysis – Daily Chart* In our Elliott Wave analysis of Texas Instruments Inc. (TXN), we observe a counter-trend corrective pattern characterized by a triangle structure. TXN is currently positioned in wave {iv} of 3, suggesting a bottoming process in wave {iv}. The recent price action indicates that TXN has encountered resistance around the TL2 trendline at $200. This resistance could imply the formation of a triangle in wave {iv}, setting the stage for a potential resumption of the upward trend once the triangle completes. Traders should monitor the $200 level for signs of a breakout or further consolidation within the triangle.   *TXN Elliott Wave Technical Analysis – 4Hr Chart* On the 4-hour chart, TXN is following a counter-trend corrective mode within a triangle structure, specifically in wave (e) of {iv}. The current analysis suggests that wave (e) is nearing completion, which could signal the end of the triangle and the beginning of a move higher. The completion of wave (e) should ideally find support above the $200 level, aligning with the daily chart's indication of a possible upward resumption post-triangle. Traders should watch for the termination of wave (e) and the subsequent price action to confirm a bullish continuation.   Technical Analyst : Alessio Barretta Source : Tradinglounge.com get trial here!  
×
×
  • Create New...
us