因子定义核心与运行快照
原能力
固定因子核心定义和每次运行快照,保留市场、样本、输入与参数版本。(合同附件 R7 10.2)
首选项目
Qlib(MIT)。 Qlib
匹配范围
保存表达式和数据集版本锁。
源码
Qlib · class LocalExpressionProvider(
qlib/data/data.py · 835–848 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
class LocalExpressionProvider(ExpressionProvider):
"""Local expression data provider class
Provide expression data from local data source.
"""
def __init__(self, time2idx=True):
super().__init__()
self.time2idx = time2idx
def expression(self, instrument, field, start_time=None, end_time=None, freq="day"):
expression = self.get_expression_instance(field)
start_time = time_to_slc_point(start_time)
end_time = time_to_slc_point(end_time)
- # Copyright (c) Microsoft Corporation.
DVC · def to_lockfile(
dvc/stage/serialize.py · 195–208 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
def to_lockfile(stage: "PipelineStage", **kwargs) -> dict:
assert stage.name
return {stage.name: to_single_stage_lockfile(stage, **kwargs)}
def to_single_stage_file(stage: "Stage", **kwargs):
state = stage.dumpd(**kwargs)
# When we load a stage we parse yaml with a fast parser, which strips
# off all the comments and formatting. To retain those on update we do
# a trick here:
# - reparse the same yaml text with a slow but smart ruamel yaml parser
# - apply changes to a returned structure
# - serialize it
实现与验收要点
运行时快照、市场权威、样本封存及可得性。