oli 0 Report post Posted September 14, 2018 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
Physicsman 30 Report post Posted September 17, 2018 Hi Oli, I'm looking into this for you and will reply as soon as I have something. Thank you for your patience. Kind Regards, PM! Share this post Link to post
Physicsman 30 Report post Posted September 17, 2018 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 } Kind Regards, PM Share this post Link to post
oli 0 Report post Posted September 19, 2018 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
Physicsman 30 Report post Posted September 19, 2018 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
Physicsman 30 Report post Posted September 20, 2018 Quick update that the issue has been resolved. Missing "Content-type" and "Accept" headings in the call were the culprits. Share this post Link to post