Jump to content

Error Return on API call

Recommended Posts

I'm using your API and trying to auto-trade on my account. It worked fine on a demo account and you have recently supplied an API key for the live account. 

I'm getting failed trades with the error code of 30, defined as: "Cannot open a new short position as the market is currently set to Long Only" I can open a short position manually so would appreciate your view on the problem to allow API trades to be placed?
You have said that "the error you are receiving is a restriction on our side. It is being applied to instruments which we you unable to offer in both directions. Please, check the Key Market Information for further details"
I have checked the Key Market Information and its clearly offered in both directions..........and I can place short trades manually which indicates its offered in both directions.
So what's the problem?

Share this post

Link to post

Hi Colin,

Quick check, is it definitely the OrderStatusReason code that is 30, or is it the InstructionStatusReason code that is 30? 

Please send the following information to help troubleshoot:

  1. Market name and Market ID you are trying to trade that is causing this error.
  2. The JSON trade request code you are sending for the trades that results in this error.
  3. The complete response header and body.
  4. How many times does this error occur? All the time or some of the time?
  5. Approximately what time are the attempted trades being made that have resulted in this error?
  6. Is it just one particular market or many different markets?
  7. Are you able to place any trades successfully?   


Thank you in advance for the additional information.

Kind Regards, PM

Share this post

Link to post

Market name is UK 100 DFT

market id for UK 100 DFT: 400616113

I've no idea what the JASON question means - just that the code works fine on my dummy account.

These are the returns I'm getting:

08:15 Jun 21 2018 4 - top ErrorMessage: 
08:15 Jun 21 2018 4 - top Quote: 
08:15 Jun 21 2018 4 - top OrderId: 0
08:15 Jun 21 2018 4 - top StatusReason: 30
08:15 Jun 21 2018 4 - top Status: 4

The code trades at 08:15 to place a trade and then 16:20 to close it unless its been stopped out during the day.

I can place any trade manually on the account but not the same trade through the API, but the API code works perfectly on my demo account.




Share this post

Link to post


Regarding JSON, I meant the JavaScript Object Notation that is sent in the trade request. The screenshot below shows a partial example. 

However, since the same code functions normally for your demo account and it is only the Live account with issues, I would suspect the issue is with the account rather than the API code.

I do not have access to Live client data. Please contact client services (who can access your live account data) and request assistance regarding this issue. 

Kind Regards, PM


Share this post

Link to post

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