Vincent 11 Report post Posted November 26, 2014 Hi, I am able to place a trade without setting a stop or limit. But when I add a stop to the request, error start to appear. I am not sure what is the correct way of setting up a stop. My request and the response I received are down below: Request: { "MarketId": 400616114, "Currency": "GBP", "AutoRollover": false, "Direction": "buy", "Quantity": 1, "QuoteId": null, "PositionMethodId": null, "BidPrice": 17842, "OfferPrice": 17846, "AuditId": "sbINXProd_NON_FX25652", "TradingAccountId": 400448826, "IfDone": [ { "Stop": { "Guaranteed": false, "TriggerPrice": 17500, "ExpiryDateTimeUTC": null, "Applicability": null, "ParentOrderId": null, "OrderId": 0, "AutoRollover": false, "MarketId": 0, "Direction": null, "Quantity": 0, "Price": null, "TradingAccountId": 0, "CurrencyId": 0, "StatusId": 0, "TypeId": 0, "IfDone": null, "OcoOrder": null }, "Limit": null } ], "Close": null} Response: {"HttpStatus":400,"ErrorMessage":"The direction of the request is invalid.","ErrorCode":60107} Thanks. 1 inatadePlalse reacted to this Share this post Link to post
Physicsman 25 Report post Posted November 26, 2014 Hello Vincent, When you add your stop and/or limit orders to an open trade, are you using the UpdateTrade command? It will be helpful to look at the "Add Stop and/or Limit Order to an Open Trade" Trading Sequence Diagram at http://docs.labs.cityindex.com/#Seq Diags.htm%3FTocPath%3DGetting%2520Started%7C_____2 When you using the UpdateTrade command, you'll need to supply the Order ID for the open position you are attaching the stop/limit to. Additionally, in the code you pasted you haven't set the direction for your stop order. The error message is complaining about invalid direction because in your request you have left it as null. You'll need to supply the direction for the stop and/or limit orders you are attaching. Share this post Link to post