Jump to content
Sign in to follow this  
oli

NewStopLimitOrder question

Recommended Posts

Please @Physicsman you've gotta help me before I pull the rest of my hair out... I'm simply trying to place a stop/limit order for the UK 100 DFT, and am failing. Here's my json:

{"AutoRollover":false, "AuditId":"5288272-1-0-0-B", "Currency":null, "Direction":"buy", "LastChangedDateTimeUTC":null, "BidPrice":7306.3,"PositionMethodId":1, "ExpiryDateTimeUTCDate":null, "MarketId":400616113, "LastChangedDateTimeUTCDate":null, "OfferPrice":7307.3, "TriggerPrice":7500.0, "Quantity":1, "IfDone":[], "TradingAccountId":40xxxxx48, "Type":null, "Applicability":"GTC", "ExpiryDateTimeUTC":null}

I'm posting it to https://ciapi.cityindex.com/tradingapi/order/newstoplimitorder?username=CXxxxxxx&session=0c39bab9-1158-47d2-8eda-c4c8828dbce8

and it's returning "ERROR 400 - Bad Request". 

I'm authorising fine and the AuditId is coming straight out of the lightstreamer feed, so I think that should be ok.. but what else could it be? Is it something obvious? The only other issue that I figured it might be is the TradingAccountId value. A couple of years back (i.e. before AuditId was necessary) this call used to work fine with my TradingAccountCode (i.e. CXxxxxxx) however, even though it does work for authorising the session, it doesn't seem to work with this call. Another guy I know who was set up post Gain take-over has been set up to have a different username altogether (i.e. neither TradingAccountId nor TradingAccountCode) so I'm wondering whether there have been some authentication changes that might be impacting old accounts?

I can DM you TradingAccountId details in case it helps...

Thank you so much

oli

Share this post


Link to post

Hi Oli,

I used the following JSON to request the Entry Buy order successfully using my test account. Please try using your account details and see if that is successful or if you still get an error message. We now have JSON code that we know works, so if you still have an error, we can then look into your account to see if that is the problem.

{ "Applicability":"GTC",
  "ExpiryDateTimeUTC":null,
  "AutoRollover":false,
  "ExpiryDateTimeUTCDate":null,
  "MarketName":"UK 100 DFT",
  "IfDone":[],
  "Close":[],
  "LastChangedDateTimeUTCDate":null,
  "TriggerPrice":7500.0,
  "BidPrice":7294.8,
  "OfferPrice":7297.3,
  "Quantity":1,
  "Direction":"buy",
  "Currency":null,
  "LastChangedDateTimeUTC":null,
  "PositionMethodId":1,
  "isTrade":false,
  "Reference":"GCAPI",
  "OcoOrder":null,
  "Type":null,
  "Status":null,
  "MarketId":400616113,
  "OrderId":0,
  "QuoteId":null,
  "AuditId":"5288272-1-0-0-B",
  "TradingAccountId":XXXXXXX
}

image.png

Kind Regards, PM

Share this post


Link to post

Hi Physicsman - thank you so much for looking into this. The (good?) news is that it still doesn't work, even with your functioning json. Below is the json used in which I replaced only the BidPrice, OfferPrice and AuditId (out of lightstreamer) and of course the TradingAccountId. Which suggests it might be something to do with the account after all..

{"Applicability":"GTC",  
"ExpiryDateTimeUTC":null,  
"AutoRollover":false,  
"ExpiryDateTimeUTCDate":null,  
"MarketName":"UK 100 DFT",  
"IfDone":[],  
"Close":[],  
"LastChangedDateTimeUTCDate":null,  
"TriggerPrice":7500.0,  
"BidPrice":7307,  
"OfferPrice":7313,  
"Quantity":1,  
"Direction":"buy",  
"Currency":null,  
"LastChangedDateTimeUTC":null,  
"PositionMethodId":1,  
"isTrade":false,  
"Reference":"GCAPI",  
"OcoOrder":null,  
"Type":null,  
"Status":null,  
"MarketId":400616113,  
"OrderId":0,  
"QuoteId":null,  
"AuditId":"45031996-4-0-0-R",  
"TradingAccountId":xxxxxxxxx}

output:
ERROR 400 - Bad Request

 

Share this post


Link to post

Hi,

Are you using a test/demo account or a Live account? If it is a test/demo, you can send me the credentials as a private message on this forum and I can check the account. 

Have you placed any trades/orders successfully on this account from any of our trading platforms? All our trading platforms use the same API with the same calls. 

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
Sign in to follow this  
×