Jump to content

SergioLage

Community Member
  • Posts

    7
  • Joined

  • Last visited

Posts posted by SergioLage

  1. 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? 🙂

     

  2. Hi, 

    I started trading Brent Crude Oil in IG platform but I could find a formula to correctly calculate the size I have to put while creating a position, based on the available amount I have. The quotation is based in points and it makes me wonder how operate.

    Any help is welcome. 

    Also, I plan to work with some leverage in the future, so any tip on this matter is also welcome. 

    Thanks.

     

  3. Hi @mattz00. I had to way for 7 days to be able to get the data again. I removed the "max" parameter and now I control the allowance by myself to avoid getting into this situation again. I still think there is a bug regarding this control. Also, it makes no sense to me having this in a demo environment, basically used to test the code and the algorithms we are developing. There are other ways to avoid issues regarding the infrastructure.

  4. I see. But I used the "max" parameter to limit the number of returned points, so how this happened? It seems to me it something is not working ok. Could someone take a look? The URL I used is https://api.ig.com/gateway/deal/prices/CC.D.LCO.UMA.IP?resolution=DAY&from=2012-06-07T00:00:00&to=2020-12-31T00:00:00&pageSize=0&max=5

     

    Also, in order to test the algorithms the DEMO account should be more flexible, and not the other way around. Any plans to have more flexibility in the DEMO account?

     

    Thanks!

     

  5. Hi, 

    I am using REST API to get historical values (DAY resolution) so I can back test my trading algorithm. I am sure I haven't reach the 10,000 points / historical limit in this week, but I got this error and it seems I will have to wait for 7 days before being able to work with it again. It seems to me there is an issue with the 10,000 points. Is anyone else facing a similar problem with this limit?

    Also, is there any plan to have a more flexible limit? I mean, limits related to rate and not to the amount of data?

     

    Thanks! 

     

    • Like 1
×
×
  • Create New...
us