Skip to content

stacksats.api

stacksats.api

Result types for strategy lifecycle operations.

BacktestResult(spd_table: pd.DataFrame, exp_decay_percentile: float, win_rate: float, score: float, strategy_id: str = 'unknown', strategy_version: str = '0.0.0', config_hash: str = '', run_id: str = '') dataclass

Structured backtest result.

plot(output_dir: str = 'output') -> dict[str, str]

Generate standard backtest plots and return output paths.

summary() -> str

Return a concise text summary of key metrics.

to_dataframe() -> pd.DataFrame

Return the SPD table.

to_json(path: str | Path | None = None) -> dict

Serialize result to a JSON-compatible dictionary.

ValidationResult(passed: bool, forward_leakage_ok: bool, weight_constraints_ok: bool, win_rate: float, win_rate_ok: bool, messages: list[str], min_win_rate: float = 50.0) dataclass

Structured validation result for a strategy.

summary() -> str

Return a concise validation summary string.