Jump to content

mf2

Community Member
  • Posts

    19
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

mf2's Achievements

Occasional Contributor

Occasional Contributor (2/10)

6

Reputation

  1. Sounds like you are looking at the ask price, or the mid price. I don't have access to the 10sec data at that time, but the 1 minute candle had a low at 7947.7. Ask low was 7954.7. So I guess you had a long position; in this case look at the bid price to see what is going on.
  2. Sounds like you have some undefined behavior in your program; you need to make sure that you supply the correct value for the CST header. Look at the API Companion, it always gets a valid session upon login.
  3. @bug-or-feature It seems that you *cannot* use the API with a CFD account to access historical price data of stocks, only indices and forex. It might work with a spread betting account, but that one is not available at least where I live.
  4. @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.
  5. You can use these endpoints to iterate over a list of all markets: https://labs.ig.com/rest-trading-api-reference/service-detail?id=670 https://labs.ig.com/rest-trading-api-reference/service-detail?id=674 I recommend not doing it though, because you can easily exhaust your API quota. Instead I recommend to use the API companion, it has some sensible defaults for these endpoints and a bit of autocompletion.
  6. Yes, you need to set the HTTP header "IG-ACCOUNT-ID" to the ID of your CFD Demo account.
  7. Judging from this code, you would query the non-existing endpoint "/sessionprices", which indeed does not exist, so the 404 is valid. You need to create a /session first, then you can query price data.
  8. Hi, that an order is accepted does not mean that it will be filled. As you are aware, after opening a position with the /otc endpoint, you will get a dealReference – described in the API as an "unconfirmed trade". With the reference you will have to check if either a confirmation or an error message is available. The recommended way is to use the LightStreamer API, otherwise you can poll the /confirms/ endpoint. See https://labs.ig.com/rest-trading-api-reference/service-detail?id=658
  9. I believe the hourly sentiment is actually what you get at the `/sentiment` endpoint: https://labs.ig.com/rest-trading-api-reference/service-detail?id=655 But at least for the DE40 it’s not very interesting; over the past couple of trading days, the sentiment was always either 52/48 or 53/47. It would be nice if even more sentiment data would be included, i.e. what you see in the trading interface.
  10. There are a couple of weekend markets, depending on where you are from I believe. For example, there is a weekend EUR/USD market.
  11. Update again: Now the split button is gone in light mode, too. Is this feature being removed?
  12. Nevermind, I found out this is only the case in Dark mode; so if you are missing the button, just switch to light mode.
  13. Suddenly the button to split the chart view vertically is gone. The funny thing is that I still have some markets with splits charts open; does anyone else have the same issue?
  14. Fascinating how complicated something supposedly simple as posting code on the IG messageboard is, just because support for proper formatting is missing. Anyway, here is a very minimal example for acessing a LightStreamer API: https://dpaste.com/BGNARUXSS Notes: It does not use IG's server, but a public demo server. However, the code is essential the same as I am using in my application. I wrote it under Linux, it might be of limited use to a Windows User. Maybe under WSL it runs. Linux users can compile it via: gcc -lcurl main.c
  15. 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: Authenticate with the REST api via a V3 session call Issue a V1 session call to get the XST and CST token 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: I use polling, which is not recommended, but its fine for my case. The `|` in the password needs to be escaped properly.
×
×
  • Create New...
us