Jump to content
  • 0

Several issues with API



Hi there,

I tried contacting the email address for help but haven't received a response in two weeks. I am building a very simple trading app and can successfully get prices for different epics, however, I have several problems:

  1. I cannot seem to get a list of open positions. The result is successful (200) but empty. I made sure that I specified the correct account and I manually create positions so that there must be data available.
  2. I have the same problem with working orders. I manually created orders in my demo account, but the result from the API is empty.
  3. When trying to create a working order, I get an error message that is not described in the documentation. Here is an example payload:
    "currencyCode": "USD",
    "direction": "SELL",
    "epic": "CS.D.GBPUSD.MINI.IP",
    "expiry": "DFB",
    "forceOpen": true,
    "goodTillDate": "2023/03/03 17:00:00",
    "guaranteedStop": false,
    "level": 1.1946,
    "limitDistance": 1,
    "size": 1,
    "timeInForce": "GOOD_TILL_DATE",
    "type": "STOP"
    And here is the error:
    "errorCode": "error.service.instrumentdata-invalid"

    Any help would be greatly appreciated.

Link to comment

1 answer to this question

Recommended Posts

  • 0

For future users:

  1. Despite indicating the correct account in the header, you actually need to switch to the account first using  the session endpoint (PUT) before you will be able to interact with the account
  2. Instead of trying to decipher what you need to add to your payload to place orders, rather use the API companion to figure it out. In my case, the payload was incorrectly configured.
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...