trade29.sc.SCBridge.cancel_order#
- SCBridge.cancel_order(key: str, order_id: int) CancelOrderResponse #
Cancels an order by its ID
Given an ID, sends a request to the SC-dX study to cancel the order with that ID.
- Parameters:
- keystr
The key matching the key given to the SC-dX custom study in Sierra Chart.
- order_idint
The ID of the order to cancel.
- Returns:
Examples
>>> from trade29.sc import SCBridge, constants >>> bridge = SCBridge() running bridge v0.15.0--------2024/06/19 19:19:03 connecting to sc starting receiver starting sender sc version: 2638, scdx version 204, connection: t29scdx2, keys: xx # Place limit order with quantity 5. >>> ret = bridge.submit_order('xx', True, 5, order_type = constants.OrderType.LIMIT, price1 = 50) # Cancel order using the returned ID. >>> ret = bridge.cancel_order('xx', ret.order_groups[0].parent_id) # Check that cancellation was a success. >>> print(ret.result) TradingOrderResult.SUCCESS