Support Board
Date/Time: Thu, 28 Nov 2024 08:01:54 +0000
Post From: Automated Trading From an Advanced Custom Study::Cancel bug or user error/misunderstanding
[2023-05-24 23:58:10] |
lakenymph - Posts: 2 |
Hi SC Support: In working through a proof of concept in using SC for trading support I’ve come across the following issue in testing order cancelling. Using Unmanaged Automated Trading settings as defined at URL: Automated Trading Management: Unmanaged Automated Trading Use Case: Need to change an Entry limit order to a market order. Constraints: Can’t use sc.ModifyOrder because this method only allows price and qty to be changed and there appears to be no other sc.* method to support order type modifications. Solution: 1) Cancel Limit via sc.CancelOrder(Order ID) Order 2) Verify Cancel Completion via sc.GetOrderByOrderID(Order ID, s_SCTradeOrder object) 3) Create Market Order via sc.BuyOrder | sc.SellOrder since trade settings are unmanaged The issue is that when sc.GetOrderByOrderID checks for status in the sc processing loop the retu s_SCTradeOrder object is undefined where OrderStatusCode == SCT_OSC_UNSPECIFIED and is not SCT_OSC_PENDINGCANCEL || SCT_OSC_CANCELED. Using an order search process via the sc.GetOrderByIndex(Index, s_SCTradeOrder object) method the order can be found with the desired SCT_OSC_CANCELED status. It seems that this is a bug or misunderstanding on my end of correctly in correctly interfacing with the sc ACSL interface. Should not a call to sc.GetOrderByOrderID method return a valid order object with its status as either SCT_OSC_PENDINGCANCEL | SCT_OSC_CANCELED? Thanks in advance for your feedback. |