trade29.sc.SCBridge.get_order_status#

SCBridge.get_order_status(key: str, order_id: int) OrderStatusResponse#

Gets the status of an order.

Gets the status of an order, including its ID, status code, price1, price2, quantity, and average fill price.

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 check.

Returns:
OrderStatusResponse

Examples

>>> from trade29.sc import SCBridge, constants
>>> bridge = SCBridge()
running bridge v0.15.0--------2024/06/19 20:25:05
connecting to sc
starting receiver
starting sender
sc version: 2638, scdx version 204, connection: t29scdx2, keys: xx
>>> order = bridge.submit_order('xx', True, 5, order_type = constants.OrderType.LIMIT, price1 = 50)
# Get status of submitted order.
>>> order_id = order.order_groups[0].parent_id
>>> status = bridge.get_order_status('xx', order_id)
# Check the status code.
>>> print(status.order_status_code) 
OrderStatusCode.OPEN
# Quantity matches what we submitted.
>>> print(status.quantity)          
5.0
>>> bridge.cancel_order('xx', order_id)
<trade29.sc.commands.CancelOrderResponse object at 0x0000018DA80C6A40>
# Check that order is successfully cancelled
>>> status = bridge.get_order_status('xx', order_id)
>>> print(status.order_status_code)
OrderStatusCode.CANCELED