INNER CODE UNIT · Python

_load_panel

initial-d/ml-quant-trading · src/mlquant/cli/main.py:56

def _load_panel(art: Path):
    """Rebuild the :class:`Panel` written by ``gen-data``, optional fields included."""
    from ..data.panel import Panel

    blob = torch.load(art / "panel.pt", weights_only=False)
    optional = {k: blob[k] for k in _OPTIONAL_PANEL_FIELDS if blob.get(k) is not None}
    return Panel(
        dates=blob["dates"], stocks=blob["stocks"],
        **{k: blob[k] for k in _PANEL_FIELDS},
        **optional,
    )


def _resolve_limit_pct(cfg, panel):
    """``limit_pct`` is a number, or ``"board"`` for per-board A-share thresholds."""
    limit_pct = cfg.get("limit_pct", 0.098)
    if isinstance(limit_pct, str):
        if limit_pct != "board":

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…