Jump to content

JulianG

Community Member
  • Posts

    22
  • Joined

  • Last visited

Recent Profile Visitors

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

JulianG's Achievements

Occasional Contributor

Occasional Contributor (2/10)

3

Reputation

  1. I am using the REST API call '/accounts' to get the balance of my demo accounts. Sometimes, this returns a 200 response code (i.e. success) but the balance is zero. If I try again, it sometimes works, but not always. I've seen this in the API companion too. I have amended my app to try 10 times at 2-second intervals, but sometimes even this does not work. Does anyone have a reliable way to get the account balance? Thanks, Julian
  2. Does stopping out occur at the average of the bid and offer price (as shown on the chart), or does it use the appropriate one depending on the direction of the trade? If the latter, please remind me which one for which 😀 Thank you. Julian
  3. My app establishes more than one session using the REST interface. The code that does this has a retry with progressively increasing waits. I have noticed that it always seems to take a few goes before it makes the connection, although it gets there in the end. I know the interface has limits on the number of transactions per second etc, but I am nowhere near breaching those. Is there a limit such as you need to wait a number of seconds between establishing sessions? Julian
  4. Looking at the API documentation, I would leave expiry and timeInForce blank. The direction should be the opposite of the direction when the position was opened. And I use POST with _method DELETE, as you are. Julian
  5. Are you definitely sending a DELETE and not a GET or a PUT?
  6. When I try to create an API key, I get the message "We can't update your preferences because of a technical problem. Please try again later.". Has anyone else had any success with this today? Julian
  7. I have a program that uses the REST API. It has a main routine and two threads (written in Python). The main routine and each of the two threads establish their own session using the API (POST /session), then set the account (PUT /session). This has worked fine for months, but for the last few weeks there has been a problem. The first creation of a session and setting the account works as before. However, when the threads come to set their accounts, I get error 401 and message 'error.security.account-token-invalid'. This program goes straight from creating the session to setting the account and it uses the CST and X-SECURITY-TOKEN returned by the session creation when it sets the account. Creating the session itself returns code 200, which indicates success. Nothing has changed in my program to cause this. The problem is intermittent and I can improve things by retrying after a few seconds, when it will sometimes work. Does anyone know of any changes at the IG end that might be causing this? Are there any obvious workarounds. One reason for having the separate sessions for the threads was to avoid any possibility of interference between them. I don't know how necessary this is. However, the program worked before and, even if I have to change it, I'd like to know what is happening. Thanks for any help or suggestions. Julian
  8. This is fixed now for me in the API companion. I can list accounts and change account. Julian
  9. Get accounts is still not working for me on demo (i.e. using the API companion)
  10. Same problem with me. It also occurs if you use the API companion. I also cannot switch accounts.
  11. Answering my own question ... I had misunderstood how this is meant to work. I assumed that when data was available for a new timestamp, that meant the candle was complete. However, this is not how it works and, of course, not how it works with the online charts. When one candle is complete, price data is immediately available for the next candle even if it is still in progress. Therefore, what I was seeing was a snapshot at a number of seconds into a new candle. Naturally, this data would not be complete and correct until the next candle had started. Julian
  12. In my Python app I submit a /markets GET request for the Epic code. This returns the bid and offer prices, along with lot_size and margin requirement. I am assuming by "spend exactly 1000" you mean commit that much margin (I am mainly familiar with spread betting and CFDs). I calculate my order size by: cash / price / margin / lot_size So, if I have £1,000 available for margin on a CFD, the price is 7,500, the margin 5% and the lot size £2 per point, that means I need to open a position for £1.33 per point. Of course, the price may have changed marginally in the fraction of a second between fetching the price, doing the calculation and opening the position, but it's close enough for me. Julian
  13. I am fetching 1min prices with an app every minute. I noticed that sometimes, my saved prices didn't match the online chart. Investigating further, it seems if you get the latest 1min price, and then get it again a few minutes later, it's slightly different. It is the same from the online API Companion. Here is a price retrieved from the Companion at 14:19 today, followed by the same data retrieved a few minutes later. You can see that the closing and high prices are different, and also the volume. (This is Epic: IX.D.FTSE.IFM.IP) Is this a predictable behaviour? How long do I need to wait before the price settles down to its final value? Thanks, Julian { "snapshotTime": "2020/05/07 14:19:00", "snapshotTimeUTC": "2020-05-07T13:19:00", "openPrice": { "bid": 5911.3, "ask": 5912.3, "lastTraded": null }, "closePrice": { "bid": 5912.3, "ask": 5913.3, "lastTraded": null }, "highPrice": { "bid": 5912.3, "ask": 5913.3, "lastTraded": null }, "lowPrice": { "bid": 5911.3, "ask": 5912.3, "lastTraded": null }, "lastTradedVolume": 10 }] } Retrieved at 14:30. { "snapshotTime": "2020/05/07 14:19:00", "snapshotTimeUTC": "2020-05-07T13:19:00", "openPrice": { "bid": 5911.3, "ask": 5912.3, "lastTraded": null }, "closePrice": { "bid": 5911.8, "ask": 5912.8, "lastTraded": null }, "highPrice": { "bid": 5913.3, "ask": 5914.3, "lastTraded": null }, "lowPrice": { "bid": 5911.3, "ask": 5912.3, "lastTraded": null }, "lastTradedVolume": 45 }
  14. I think you need to leave the Epic blank. There reference page says: [Constraint: Set only one of {dealId,epic}] See https://labs.ig.com/rest-trading-api-reference/service-detail?id=542 Also, I'm not sure about the SELL. I've a feeling that I have had to use the same direction as my original trade, but I couldn't be 100% sure. It's worth checking. Julian
×
×
  • Create New...
us