Skip to content

Commit

Permalink
Update order attributes instead of returning multiple values
Browse files Browse the repository at this point in the history
(cherry picked from commit 762a63e)
  • Loading branch information
tgibson11 committed Jul 31, 2023
1 parent 4ab763e commit a8838df
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions sysexecution/stack_handler/balance_trades.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,12 @@ def create_balance_trade(self, broker_order: brokerOrder):
log.debug("Putting balancing trades on stacks")

try:
(
instrument_order_id,
contract_order_id,
broker_order_id,
) = self.put_balance_trades_on_stack(
self.put_balance_trades_on_stack(
instrument_order, contract_order, broker_order
)
except failureWithRollback:
return None

contract_order.order_id = contract_order_id
instrument_order.order_id = instrument_order_id

log.debug("Updating positions")
self.apply_position_change_to_stored_contract_positions(
contract_order, contract_order.fill, apply_entire_trade=True
Expand All @@ -47,7 +40,7 @@ def create_balance_trade(self, broker_order: brokerOrder):

log.debug("Marking balancing trades as completed and historic order data")
self.handle_completed_instrument_order(
instrument_order_id, treat_inactive_as_complete=True
instrument_order.order_id, treat_inactive_as_complete=True
)

def put_balance_trades_on_stack(
Expand Down Expand Up @@ -121,9 +114,10 @@ def put_balance_trades_on_stack(
)
raise failureWithRollback from e

log.debug("All balancing trades added to stacks")
contract_order.order_id = contract_order_id
instrument_order.order_id = instrument_order_id

return instrument_order_id, contract_order_id, broker_order_id
log.debug("All balancing trades added to stacks")

def rollback_balance_trades(
self, instrument_order_id: int, contract_order_id: int, broker_order_id: int
Expand Down

0 comments on commit a8838df

Please sign in to comment.