INNER CODE UNIT · Python

_resolve_position_intents

qrak/LLM_trader · src/app.py:463

    async def _resolve_position_intents(self, decision: Any, delivered: bool) -> str | None:
        """Hand the forwarded command's intent to the strategy for evidence-based closure.

        Only the strategy's executor evidence may confirm it; a missing hook (test double,
        no intent layer) leaves the state unknown here instead of inventing one.
        """
        resolver = getattr(self.trading_strategy, "resolve_position_intents_after_forward", None)
        state: Any = None
        if callable(resolver):
            try:
                pending = resolver(
                    order_id=getattr(decision, "order_id", None),
                    delivered=delivered,
                    symbol=self.current_symbol,
                )
                if inspect.isawaitable(pending):
                    state = await pending
            except Exception as e:  # noqa: BLE001

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…