Strategy Object¶
A strategy subclasses BaseStrategy (stacksats/strategy_types.py) and defines:
- identity:
strategy_id,version,description - hooks:
transform_features,build_signals - intent path:
propose_weight(...)orbuild_target_profile(...)
Ownership model¶
Framework vs user
User code owns features/signals/intent. Framework code owns iteration, clipping, and invariants.
Framework-owned behavior remains sealed:
- compute kernel (
compute_weightsinBaseStrategy) - clipping and remaining-budget enforcement
- lock semantics and final invariants
Minimal strategy shape¶
class MyStrategy(BaseStrategy):
strategy_id = "my-strategy"
version = "1.0.0"
def transform_features(self, ctx: StrategyContext) -> pd.DataFrame:
...
def build_signals(self, ctx: StrategyContext, features_df: pd.DataFrame) -> dict[str, pd.Series]:
...
def build_target_profile(self, ctx: StrategyContext, features_df: pd.DataFrame, signals: dict[str, pd.Series]) -> TargetProfile:
...