-
June 12th, 2024, 03:46 PM
#1
Status: CONNECTING
Hi,
I am currently working on integrating the IG API to receive live streaming data for my Demo and Live trading accounts.
Despite following the documentation and ensuring my credentials and endpoint configurations are correct, I am not receiving any real-time data updates.
I am able to successfully obtain tokens and authenticate, but no streaming data is received. Below is a snippet of the log output:
"Obtaining tokens...
Starting new HTTPS connection (1): demo-api.ig.com:443
https://demo-api.ig.com:443 "POST /gateway/deal/session HTTP/1.1" 200 617
Successfully obtained tokens
2024-06-12 15:25:55.200056|INFO |lightstreamer.actions|MainThread|serverAddress changed: https://demo-apd.marketdatasystems.com
2024-06-12 15:25:55.200104|INFO |lightstreamer.actions|MainThread|adapterSet changed: Demo
2024-06-12 15:25:55.200128|INFO |lightstreamer.actions|MainThread|user changed: ******
2024-06-12 15:25:55.200146|INFO |lightstreamer.actions|MainThread|password changed
2024-06-12 15:25:55.200162|INFO |lightstreamer.actions|MainThread|adapterSet changed: Demo
2024-06-12 15:25:55.200539|INFO |lightstreamer.actions|MainThread|Subscription requested: subId: 1 [mode => MERGE, items => [CS.D.GBPUSD.TODAY.IP], fields => [BID,OFFER,HIGH,LOW,UPDATE_TIME,MARKET_STATE], dataAdapter => QUOTE_ADAPTER, requestedSnapshot => SnpYes]
2024-06-12 15:25:55.200712|INFO |lightstreamer.actions|MainThread|Connection requested: details: [serverAddress => https://demo-apd.marketdatasystems.com, adapterSet => Demo, user => ZHCYW, libVersion => python_client 2.1.0 build 20231219] options: [requestedMaxBandwidth => BWUnlimited, retryDelay => 4000, firstRetryMaxDelay => 100, sessionRecoveryTimeout => 15000, reverseHeartbeatInterval => 0, stalledTimeout => 2000, reconnectTimeout => 3000, keepaliveInterval => 0, pollingInterval => 0, idleTimeout => 19000, contentLength => 50000000, slowingEnabled => false, serverInstanceAddressIgnored => false, HTTPExtraHeadersOnSessionCreationOnly => false]
2024-06-12 15:25:55.200757|INFO |lightstreamer.session|MainThread|Status: CONNECTING
2024-06-12 15:25:55.200792|DEBUG|lightstreamer.stream|MainThr ead|WS connecting: https://demo-apd.marketdatasystems.com/lightstreamer headers(null)"
Could you please assist in troubleshooting this issue or confirm if there are any additional steps, configurations or debugging tests to isolate the reason that is stopping access to live streaming data?
Thank you for your assistance.
Best regards,
James
-
June 13th, 2024, 08:41 AM
#2
Hi James,
The 'CONNECTING' state of the client library is only temporary. In fact, within few seconds, you should find one of the three possible outcomes:
- connection successful,
- connection failed with some indication of the problem,
- otherwise, a timeout should trigger a retry mechanism.
Could you provide a snippet of the log following the one you posted here to ascertain which case your test ends up in?
If it is the third case, with a repeated cycle of retries, the most common cause is a network issue where the client is unable to contact the server.
Regards,
Giuseppe
-
June 13th, 2024, 01:03 PM
#3
Hi Giuseppe
thank you for your response.
The log doesn't continue at all, just proceeds immediately to the command prompt.
=> python_client 2.1.0 build 20231219] options: [requestedMaxBandwidth => BWUnlimited, retryDelay => 4000, firstRetryMaxDelay => 100, sessionRecoveryTimeout => 15000, reverseHeartbeatInterval => 0, stalledTimeout => 2000, reconnectTimeout => 3000, keepaliveInterval => 0, pollingInterval => 0, idleTimeout => 19000, contentLength => 50000000, slowingEnabled => false, serverInstanceAddressIgnored => false, HTTPExtraHeadersOnSessionCreationOnly => false]
2024-06-13 12:52:42.956102|INFO |lightstreamer.session|MainThread|Status: CONNECTING
2024-06-13 12:52:42.956248|DEBUG|lightstreamer.stream|MainThr ead|WS connecting: https://demo-apd.marketdatasystems.com/lightstreamer headers(null)
(myenv) (base) *******************@Jamess-MacBook-Pro-2 VS CODE %
Regards
James
-
June 13th, 2024, 02:45 PM
#4
When integrating the Lightstreamer library into your Python application, it's important to understand its asynchronous nature. The LightstreamerClient.connect() method is non-blocking, which means it won't halt the execution of your program. Instead, it initiates a connection in the background, allowing your program to continue running while it connects to the server.
For a practical demonstration, consider reviewing the Python demo provided with the library. It showcases how to effectively use the LightstreamerClient to establish a connection and manage real-time data subscriptions.
-
June 14th, 2024, 10:19 AM
#5
Hi Alessandro
This was very helpful and worked fine thanks.
So now just looking to build and adapt. But already have an issue with "Cause: 2 - Requested Adapter Set not available"
Trying to locate the 'adapters.xml' but not in client dir, is this on Lightstreamer server?
This is the output:
Obtaining tokens...
Starting new HTTPS connection (1): demo-api.ig.com:443
https://demo-api.ig.com:443 "POST /gateway/deal/session HTTP/1.1" 200 617
Successfully obtained tokens
2024-06-14 09:51:57.778551|INFO |lightstreamer.actions|MainThread|serverAddress changed: https://demo-apd.marketdatasystems.com
2024-06-14 09:51:57.778720|INFO |lightstreamer.actions|MainThread|adapterSet changed: DEMO
2024-06-14 09:51:57.778792|INFO |lightstreamer.actions|MainThread|user changed: ******
2024-06-14 09:51:57.778840|INFO |lightstreamer.actions|MainThread|password changed
2024-06-14 09:51:57.778887|INFO |lightstreamer.actions|MainThread|adapterSet changed: DEMO
2024-06-14 09:51:57.780093|INFO |lightstreamer.actions|MainThread|Subscription requested: subId: 1 {mode => MERGE, items => [CS.D.GBPUSD.CFD.IP], fields => [BID,OFFER,HIGH,LOW], dataAdapter => QUOTE_ADAPTER, requestedSnapshot => SnpYes}
2024-06-14 09:51:57.780481|INFO |lightstreamer.actions|MainThread|Connection requested: details: {serverAddress => https://demo-apd.marketdatasystems.com, adapterSet => DEMO, user => ********, libVersion => python_client 1.0.3 build 20230622} options: {requestedMaxBandwidth => BWUnlimited, retryDelay => 4000, firstRetryMaxDelay => 100, sessionRecoveryTimeout => 15000, reverseHeartbeatInterval => 0, stalledTimeout => 2000, reconnectTimeout => 3000, keepaliveInterval => 0, pollingInterval => 0, idleTimeout => 19000, contentLength => 50000000, slowingEnabled => false, serverInstanceAddressIgnored => false, HTTPExtraHeadersOnSessionCreationOnly => false}
2024-06-14 09:51:57.780617|INFO |lightstreamer.session|MainThread|Status: CONNECTING
2024-06-14 09:51:57.780756|DEBUG|lightstreamer.stream|MainThr ead|WS connecting: https://demo-apd.marketdatasystems.com/lightstreamer headers(null)
2024-06-14 09:51:58.095957|DEBUG|lightstreamer.stream|LS_IO|W S event: open
2024-06-14 09:51:58.102420|INFO |lightstreamer.protocol|Thread-3|Sending session create: LS_adapter_set=DEMO LS_user=********* LS_cid=v Wntytg4pkpW36AK3P4hwLri8M4OA68h8x LS_send_sync=false LS_cause=api
2024-06-14 09:51:58.109013|DEBUG|lightstreamer.stream|Thread-3|WS sending: wsok
2024-06-14 09:51:58.109138|DEBUG|lightstreamer.stream|Thread-3|WS sending: create_session
LS_adapter_set=DEMO&LS_user=*******&LS_cid=v%20Wnt ytg4pkpW36AK3P4hwLri8M4OA68h8x&LS_send_sync=false& LS_cause=api&LS_password=CST-714d51ac4819********************************bfba3c ebc862597CC01115%7CXST-7af4a8312e4a********************************2a8bfb 0b2cfa04f5419a18ca3f9dCD01115
2024-06-14 09:51:58.153643|DEBUG|lightstreamer.stream|LS_IO|W S event: text(WSOK)
2024-06-14 09:51:58.153865|DEBUG|lightstreamer.protocol|Threa d-3|WSOK
2024-06-14 09:51:58.159224|DEBUG|lightstreamer.stream|LS_IO|W S event: text(CONERR,2,Requested Adapter Set not available)
2024-06-14 09:51:58.166283|DEBUG|lightstreamer.protocol|Threa d-3|CONERR 2 Requested Adapter Set not available
2024-06-14 09:51:58.166345|DEBUG|lightstreamer.stream|Thread-3|WS disposing
2024-06-14 09:51:58.172740|INFO |lightstreamer.session|Thread-3|Status: DISCONNECTED
2024-06-14 09:51:58.172801|ERROR|lightstreamer.session|Thread-3|Disconnected. Cause: 2 - Requested Adapter Set not available
Thanks
James
-
June 14th, 2024, 10:36 AM
#6
Hi James,
I can confirm that the Adapter Set is configured at the server-side and has to match with the one passed in the connection request of the client.
In your case you specify 'DEMO', that is one of the Adapter Sets used by our public demos.
You should refer to the IG guide here: https://labs.ig.com/streaming-api-guide.html
For example the Adapter Set should not be configured since it seems the 'DEFAULT' value is used; so you can simply not specify it at all.
Regards,
Giuseppe
-
June 14th, 2024, 01:58 PM
#7
Hi Giuseppe
This was very helpful guidance and worked, I am very greatful thank you!
Best regards
James
Similar Threads
-
By Victor Yew in forum Client SDKs
Replies: 4
Last Post: May 29th, 2013, 05:15 AM
-
By mr_gray in forum Client SDKs
Replies: 5
Last Post: December 20th, 2010, 01:37 PM
-
By jsharpe in forum Client SDKs
Replies: 4
Last Post: February 4th, 2009, 11:45 PM
-
By wmolde in forum Client SDKs
Replies: 1
Last Post: April 20th, 2007, 05:18 PM
-
Replies: 1
Last Post: March 15th, 2007, 02:44 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 12:08 PM.
Bookmarks