Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different Session API version between demo and live #540

Closed
Brookie144 opened this issue Oct 3, 2023 · 5 comments · Fixed by #544
Closed

Different Session API version between demo and live #540

Brookie144 opened this issue Oct 3, 2023 · 5 comments · Fixed by #544

Comments

@Brookie144
Copy link
Contributor

Hi Benny,

I've just starting using this package, and it's really great! What I am trying to do is use the LightStreamer API to return candle data. If I use the demo environment it works fine, it's only when I try to use the live environment the LightStreamer connection stays at 'Disconnected'.

Looking at the session object between the Live and Demo, it looks like Demo is returning the Version 3 POST object from the Session API (https://labs.ig.com/rest-trading-api-reference/service-detail?id=686) where as the Live environment is returning Version 2. One of the differences is where the accountid is stored in the response. In V3, the accountId is in the response, where in V2 the accountId information is located in an accountInfo object.

I am able to login to the REST Trading API but am not able to login to the LightStreamer API as it it looks like it requires the accountid to be used as the username to make the connection.

Not sure if I am doing something wrong, so appreciate any advice anyone can provide.

@bennycode
Copy link
Owner

Hi @Brookie144 and thank you for reporting this issue. Are you using v0.13.6 or did you locally check out the code of "ig-trading-api"?

I remember that @krooq also couldn't subscribe to the live LightStreamer API but fixed it by downgrading the "lightstreamer-client-node" dependency: #514

@Brookie144
Copy link
Contributor Author

Brookie144 commented Oct 3, 2023

Hi @bennycode, thanks for responding so quicky. I was using v0.13.3, I have updated to v0.13.6 and also tried to downgrade the 'lightstreamer-client-node' version from 8.0.5 to 8.0.4 and 8.0.1 and still run into the same issue.

Edit:
I found a hacky work around, It looks like in the LoginAPI file there is a createSessionFromMobileLogin method that is used to login when there is a Live connection (

return this.createSessionFromMobileLogin(username, password);
). Replacing this with the createSession method instead seems to have fixed it.

@bennycode
Copy link
Owner

@Brookie144 does it work now with v0.13.7?

@Brookie144
Copy link
Contributor Author

Hi @bennycode just tried with v0.13.7 and can confirm that I can login to the Lightstreamer API using a live account.

@bennycode
Copy link
Owner

Cool! Thanks for your help. 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants