INNER CODE UNIT · Python
_build_execution_note
qrak/LLM_trader · src/app.py:637
def _build_execution_note(
self,
result: dict[str, Any],
decision: TradeDecision | None,
stale_recommendation: bool,
reconcile_outcome: LocalPositionReconciliation | None,
protection_guard_note: str | None = None,
protection_version_note: str | None = None,
intent_state: str | None = None,
) -> str | None:
"""Explain WHY an actionable recommendation was not executed, or None.
Returns None only when the recommendation WAS performed with executor evidence
(or when there was nothing actionable to perform). A command that was forwarded
but not yet confirmed keeps its note: the card must say pending/unknown instead
of showing an execution. The text is shown verbatim on the Discord card.
"""
analysis = result.get("analysis") or {}