Skip to content

Commit

Permalink
[RemoteTradingSignalsTradingMode] accuratly handle chained orders error
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Oct 3, 2023
1 parent f1d32ab commit 3172965
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,20 @@ async def _bundle_order(self, order_description, to_create_orders, ignored_order

async def _chain_order(self, order_description, created_orders, ignored_orders, chained_to, fees_currency_side,
created_groups, symbol, order_description_by_id):
failed_order_creation = False
try:
base_order = created_orders[chained_to]
if base_order is None:
# when an error occurred when creating the initial order
failed_order_creation = True
raise KeyError
except KeyError as e:
if chained_to in ignored_orders:
self.logger.error(f"Ignored order chained to id {chained_to}: "
f"associated master order has not been created")
if chained_to in ignored_orders or failed_order_creation:
message = f"Ignored order chained to id {chained_to}: associated master order has not been created"
if failed_order_creation:
self.logger.info(message)
else:
self.logger.error(message)
else:
self.logger.error(
f"Ignored chained order from {order_description}. Chained orders have to be sent in the same "
Expand Down

0 comments on commit 3172965

Please sign in to comment.