Skip to content

Commit 34c7012

Browse files
authored
Allow passing order object to modify_order() to skip get_order() call (#47)
For time-critical order modifications (e.g., bracket modifications during position reversals), the get_order() call adds ~500-800ms of network latency. Callers can now pass `order=` with an object containing the required fields (account_id, basket_id, symbol, exchange, quantity, price_type, price) to skip the lookup. Existing callers without `order=` are unaffected. Fixes #46
1 parent 8513adc commit 34c7012

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎async_rithmic/plants/order.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,15 @@ async def modify_order(self, **kwargs):
322322
- `target_ticks`: New take-profit in ticks
323323
324324
Note: we can't update SL/TP/main order concurrently or Rithmic will send back an error: 'Atomic order operation in progress'
325+
326+
For time-critical modifications, pass `order=` with an object containing
327+
the required fields (account_id, basket_id, symbol, exchange, quantity,
328+
price_type, price) to skip the get_order() network call.
325329
"""
326330

327-
order = await self.get_order(**kwargs)
331+
order = kwargs.pop('order', None)
332+
if order is None:
333+
order = await self.get_order(**kwargs)
328334
if not order:
329335
raise Exception(f"Order not found: {kwargs}")
330336

0 commit comments

Comments
 (0)