Jump to content

JulianG

Community Member
  • Posts

    24
  • 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)

4

Reputation

  1. Looking at the API documentation, it seems that each call has version 1, and maybe other later versions. I assume we ought to use the latest version for a new application, but the older versions remain so things don't break. e.g. You would use version 2 (the latest) to create a position and version 1 (the only one) to close it. Julian
  2. The only thing I can see is the version, which should be 1 for DELETE and not 2.
  3. 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
  4. 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
  5. 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
  6. 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
  7. Are you definitely sending a DELETE and not a GET or a PUT?
  8. 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
  9. 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
  10. This is fixed now for me in the API companion. I can list accounts and change account. Julian
  11. Get accounts is still not working for me on demo (i.e. using the API companion)
  12. Same problem with me. It also occurs if you use the API companion. I also cannot switch accounts.
  13. 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
  14. 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
×
×
  • Create New...
us