INNER CODE UNIT · Python
cmd_features
initial-d/ml-quant-trading · src/mlquant/cli/main.py:239
def cmd_features(config_path: str) -> None:
cfg = load_config(config_path)
seed_everything(cfg.get("seed", 42))
art = _artifacts_dir(cfg)
panel = _load_panel(art)
bias_mask = limit_move_mask(panel, limit_pct=_resolve_limit_pct(cfg, panel))
# Mask-first: factors read ``panel.mask``, so limit-move prices are
# excluded from every rolling window, not only from the limit day's row.
factors, mask, names = compute_legacy_set(replace(panel, mask=bias_mask))
mask = mask & bias_mask
torch.save({"factors": factors, "mask": mask, "names": names}, art / "features.pt")
click.echo(f"wrote features: {factors.shape} alphas={names}")
@cli.command("train")
@click.option("--config", "config_path", required=True, type=click.Path(exists=True))
def cmd_train(config_path: str) -> None:
cfg = load_config(config_path)