trade29.sc.SCBridge.modify_order#
- SCBridge.modify_order(key: str, order_id: int, quantity: float, price1: float = 0, price2: float = 0) ModifyOrderResponse #
Modifies the quantity or price settings of an order.
- 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 modify.
- quantityfloat
The new quantity to change the order to.
- price1float, default 0
Refer to the documentation for
OrderType
for what (if anything) price1 represents for this order.- price2float, default 0
Refer to the documentation for
OrderType
for what (if anything) price2 represents for this order.
- Returns:
Examples
>>> from trade29.sc import SCBridge, constants >>> bridge = SCBridge() running bridge v0.15.0--------2024/06/19 20:46:26 connecting to sc starting receiver starting sender sc version: 2638, scdx version 204, connection: t29scdx2, keys: xx # Submit a limit order with quantity 5. >>> order = bridge.submit_order('xx', True, 5, order_type = constants.OrderType.LIMIT, price1 = 50) >>> order_id = order.order_groups[0].parent_id # Get its quantity and check that it is correct. >>> quantity = bridge.get_order_status('xx', order_id).quantity >>> print(quantity) 5.0 # Modify order to now have a quantity of 7. >>> result = bridge.modify_order('xx', order_id, quantity=7) # Check that modification worked. >>> print(result.result) TradingOrderResult.SUCCESS >>> quantity = bridge.get_order_status('xx', order_id).quantity >>> print(quantity) 7.0