历史因子迁移与因子库规模
原能力
显式迁移历史因子及旧定义,保留原版本、映射和不支持范围。(合同附件 R7 10.12)
首选项目
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
实现与验收要点
历史定义映射、不可支持项、规模性能及独立复算。