INNER CODE UNIT · Python
_report_executor_side_exit
qrak/LLM_trader · src/app.py:832
async def _report_executor_side_exit(self) -> None:
"""Send the closing performance summary after an exchange-side exit.
The exchange closed the position (SL/TP filled), so the local monitor never
saw a close and reports nothing. The strategy books the trade from the
executor's exit journal and flags the reason for us here.
"""
reason = self.trading_strategy.take_executor_side_exit_reason()
if not isinstance(reason, str) or not reason:
return
self.logger.info("Exchange-side exit booked (%s) — sending performance summary", reason)
try:
await self._require_position_monitor().handle_position_closed(reason)
except Exception as e: # noqa: BLE001
self.logger.warning("Failed to report exchange-side exit: %s", e)
async def _handle_new_position(self, decision, current_price: float | None):