INNER CODE UNIT · Python
_position_snapshot_token
qrak/LLM_trader · src/app.py:546
def _position_snapshot_token(self) -> str | None:
"""Current position revision token, or None when the strategy has no contract."""
token_fn = getattr(self.trading_strategy, "position_snapshot_token", None)
if not callable(token_fn):
return None
token = token_fn()
return token if isinstance(token, str) else None
def _protection_snapshot(self) -> tuple[Any, Any] | None:
"""(stop_loss, take_profit) of the current position, or None without a contract."""
snapshot_fn = getattr(self.trading_strategy, "protection_snapshot", None)
if not callable(snapshot_fn):
return None
snapshot = snapshot_fn()
return tuple(snapshot) if isinstance(snapshot, tuple) and len(snapshot) == 2 else None
async def _protection_version(self) -> str | None:
"""Protection revision the executor reports, or None without that contract.