INNER CODE UNIT · Python

BacktestResult

initial-d/ml-quant-trading · src/mlquant/backtest/engine.py:32

class BacktestResult:
    portfolio_returns: np.ndarray          # [T] net of costs
    gross_returns:     np.ndarray          # [T] gross
    cumulative_equity: np.ndarray          # [T]
    weights:           np.ndarray          # [T, N]
    cost_drag_cumulative: float            # total cost paid over the whole run
    metrics:           dict                # summary table

    @property
    def cost_drag(self) -> float:
        """Deprecated alias for :attr:`cost_drag_cumulative`.

        The name was ambiguous: this figure is cumulative over the backtest,
        while ``ann_return``, ``gross_ann_return`` and ``ann_vol`` alongside it
        are annualised. Kept for one release so existing scripts and archived
        JSON reports keep working. Prefer ``cost_drag_cumulative``.
        """
        return self.cost_drag_cumulative

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…