Skip to content

Commit 17d1675

Browse files
committed
Improve error handling for Bybit executions
1 parent 959261f commit 17d1675

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

nautilus_trader/adapters/bybit/execution.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,8 @@ def _process_execution(
11271127

11281128
if client_order_id is None:
11291129
self._log.debug(
1130-
f"Cannot process order execution for {venue_order_id!r}: no `ClientOrderId` found (most likely due to being an external order)",
1130+
f"Cannot process order execution for {venue_order_id!r}: "
1131+
"no `ClientOrderId` found (most likely due to being an external order)",
11311132
)
11321133
return
11331134

@@ -1152,9 +1153,16 @@ def _process_execution(
11521153
strategy_id = order.strategy_id
11531154
order_type = order.order_type
11541155

1156+
if strategy_id is None:
1157+
raise ValueError(
1158+
f"Cannot handle trade event: strategy ID not found for {client_order_id!r}",
1159+
)
1160+
11551161
instrument = self._cache.instrument(instrument_id)
11561162
if instrument is None:
1157-
raise ValueError(f"Cannot handle trade event: instrument {instrument_id} not found")
1163+
raise ValueError(
1164+
f"Cannot handle trade event: instrument {instrument_id} not found",
1165+
)
11581166

11591167
quote_currency = instrument.quote_currency
11601168
is_maker = execution.isMaker

0 commit comments

Comments
 (0)