INNER CODE UNIT · Python

_protection_version

qrak/LLM_trader · src/app.py:562

    async def _protection_version(self) -> str | None:
        """Protection revision the executor reports, or None without that contract.

        Wave-5 requirement (3). The strategy's ``executor_protection_version`` asks the
        executor's ``/position`` for its ``protection_version`` (monotonic counter of
        protection changes; ``0`` = none observed, returned verbatim). An older executor
        without the field gives None, in which case the guard below stays inert (it
        never guesses a version). A strategy double / older strategy without the method
        also yields None — the guard must not fail a trading cycle over a missing hook.
        """
        version_fn = getattr(self.trading_strategy, "executor_protection_version", None)
        if not callable(version_fn):
            return None
        try:
            version = await version_fn()
        except Exception as e:  # noqa: BLE001
            self.logger.warning("Protection version query failed: %s", e)
            return None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…