和顺 / 衡律 返回所属 Agent
24.5

策略回测与模拟账户

原能力

按冻结输入和撮合模型实施策略回测及模拟账簿,明确有限模型边界。(合同附件 R7 24.5)

首选项目

Qlib(MIT)。 Qlib

匹配范围

策略回测与模拟账户组件。

源码

Qlib · def backtest(

qlib/backtest/__init__.py · 217–230 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
def backtest(
    start_time: Union[pd.Timestamp, str],
    end_time: Union[pd.Timestamp, str],
    strategy: Union[str, dict, object, Path],
    executor: Union[str, dict, object, Path],
    benchmark: str = "SH000300",
    account: Union[float, int, dict] = 1e9,
    exchange_kwargs: dict = {},
    pos_type: str = "Position",
) -> Tuple[PORT_METRIC, INDICATOR_METRIC]:
    """initialize the strategy and executor, then backtest function for the interaction of the outermost strategy and
    executor in the nested decision execution

    Parameters
  • # Copyright (c) Microsoft Corporation.

实现与验收要点

时点可得性、原业务账、真实品种与情景限定。