szcxdave1988 2 Report post Posted August 12, 2021 when i make a new trade https://ciapi.cityindex.com/TradingAPI/order/newtradeorder with IfDone value i got reson code 75: The total quantity of guaranteed stop orders must be equal to trade order quantity. but all the stop and limit order's quantity are the same as order's, how to do with it? this is my post data for swift : TradeData(IfDone: [exchange.IfDone(Stop: Optional(exchange.StopLimit(ExpiryDateTimeUTC: nil, Guaranteed: Optional(false), Direction: Optional("buy"), Quantity: Optional(1000), Applicability: "gtc", TriggerPrice: 110.42855, ParentOrderId: nil, Associated: false)), Limit: Optional(exchange.StopLimit(ExpiryDateTimeUTC: nil, Guaranteed: Optional(false), Direction: Optional("buy"), Quantity: Optional(1000), Applicability: "gtc", TriggerPrice: 110.42236, ParentOrderId: nil, Associated: false)))], Direction: exchange.Direction.sell, BidPrice: 110.425, OfferPrice: 110.437, AuditId: "EG12346253", MarketId: 401484414, Quantity: 1000, TradingAccountId: 401819215, PriceTolerance: 1000, Close: []) the response is: { "OrderId" : 0, "Quote" : null, "StatusReason" : 75, "Orders" : [ { "IfDone" : [ ], "Status" : 1, "TriggerPrice" : 0, "AssociatedOrders" : { "Limit" : { "OrderId" : 0, "Status" : 10, "Quantity" : 1000, "OrderTypeId" : 3, "AssociatedOrders" : { "Limit" : null, "Stop" : null }, "GuaranteedPremium" : 0, "StatusReason" : 49, "Associated" : true, "Price" : 0, "OCO" : null, "TriggerPrice" : 113.468, "CommissionCharge" : 0, "IfDone" : [ ] }, "Stop" : { "OrderId" : 0, "Status" : 10, "Quantity" : 1000, "OrderTypeId" : 2, "AssociatedOrders" : { "Limit" : null, "Stop" : null }, "GuaranteedPremium" : 0, "StatusReason" : 49, "Associated" : true, "Price" : 0, "OCO" : { "OrderId" : 0, "AssociatedOrders" : { "Limit" : null, "Stop" : null }, "GuaranteedPremium" : 0, "Associated" : true, "Price" : 0, "TriggerPrice" : 113.468, "StatusReason" : 49, "Quantity" : 1000, "OCO" : null, "CommissionCharge" : 0, "OrderTypeId" : 3, "Status" : 10, "IfDone" : [ ] }, "TriggerPrice" : 105.592, "CommissionCharge" : 0, "IfDone" : [ ] } }, "Quantity" : 1000, "CommissionCharge" : 0, "Price" : 0, "OCO" : null, "OrderId" : 0, "OrderTypeId" : 1, "StatusReason" : 1, "Associated" : false, "GuaranteedPremium" : 0 } ], "Status" : 2, "Actions" : [ ], "ErrorMessage" : null } Share this post Link to post
Physicsman 30 Report post Posted August 12, 2021 Hi Dave, The code 75 you are seeing is the InstructionStatusReason code, and 75 means "Instruction processing has resulted in a Red Card. Please check details." If you look further into the body of your response you will see there are StatusReason 49 codes as well. It is these that are the OrderStatusReason code, and 49 means "Trigger level does not conform to minimum distance requirements specified for the market." Is the entry price of your order to close to the current Buy/Sell price? Kind Regards, PM Share this post Link to post
szcxdave1988 2 Report post Posted August 13, 2021 No i donot think it's the distance problem. please see the attached image, i used the same data on your website platform works with no problem , but on my app return the 49 error code Share this post Link to post
Physicsman 30 Report post Posted August 13, 2021 Hi Dave, Probably most efficient to show you the API body of a call that successfully places a trade at market with stop losses and take profit limits. You can then re-use this POST body editing for the current BId/Ask prices, the stop/limit levels and Trading Account ID etc. Since we know this POST body works, if it does NOT work for you we can start narrowing down to see where the problem is. { "MarketId": 401484414, "Direction": "sell", "Quantity": 1000, "BidPrice": 110.279, "OfferPrice": 110.29, "AuditId": "EF70508008", "TradingAccountId": 401637645, "PositionMethodId": 1, "IfDone": [ { "Stop": { "OrderId": null, "Direction": "buy", "Applicability": "gtc", "ExpiryDateTimeUTC": null, "Guaranteed": false, "Quantity": 1000, "TriggerPrice": 121.308, "IfDone": [], "OcoOrder": null, "TriggerLevelCalculationTypeId": null, "TriggerLevelCalculationValue": null }, "Limit": { "OrderId": null, "Direction": "buy", "Applicability": "gtc", "ExpiryDateTimeUTC": null, "Quantity": 1000, "TriggerPrice": 99.249, "IfDone": [], "OcoOrder": null, "TriggerLevelCalculationTypeId": null, "TriggerLevelCalculationValue": null } } ], "PriceTolerance": 1000 } Kind Regards, PM Share this post Link to post
szcxdave1988 2 Report post Posted August 14, 2021 thanks, is there any way i can test on weekend, as all the markets closed Share this post Link to post
szcxdave1988 2 Report post Posted August 16, 2021 I have tested with the same data, but still got error code 49 Share this post Link to post
Physicsman 30 Report post Posted August 16, 2021 Hi Dave, Are you using a demo/test account or a real money Live account? If, and only if you are using a demo/test account, please send me a private message with your account login crednetials. I can then use your account to do some testing directly with API calls and see what happens. Many thanks, PM Share this post Link to post
szcxdave1988 2 Report post Posted August 16, 2021 I am using demo account and sent the login info to you. thanks 1 Physicsman reacted to this Share this post Link to post
szcxdave1988 2 Report post Posted August 16, 2021 I got the problem, i pass the limit price to the stop price.... Thanks for your help, my mistake 1 Physicsman reacted to this Share this post Link to post
Physicsman 30 Report post Posted August 16, 2021 Hi Dave, Very happy to hear you managed to sort out the problem. Kind Regards, PM Share this post Link to post