betting_combat.store.models
Fitted model versions (betting.betting_combat.model_versions).
The live engine only ever reads the active version. A refit lands a
candidate; promotion retires the old active version and activates the new
one inside one transaction (a partial unique index allows one active version
per strategy, so the order of the two updates matters).
Classes
ModelStore
active
active(strategy: str) -> ModelVersion | Noneadd_candidate
add_candidate(strategy: str, params: dict[str, Any], metrics: dict[str, Any], trained_through: dt.date | None, code_version: str | None, notes: str | None = None, status: VersionStatus = 'candidate') -> intLand a new version numbered one past the highest; returns its number.
get
get(strategy: str, version: int) -> ModelVersion | Nonehistory
history(strategy: str) -> list[ModelVersion]promote
promote(strategy: str, version: int, unless_locked_after: str | None = None) -> boolMake version the active one; the previous active version is retired. With
unless_locked_after (an ISO cutoff): nothing changes, and False is returned, when the
active version’s metrics.cutoff is later — checked inside the same transaction, the
active row locked (a concurrent promotion waits).
set_metrics
set_metrics(strategy: str, version: int, metrics: dict[str, Any]) -> None