refactor: unify qlib experiment configs, runners, and templates (#1320)

* refactor: unify qlib experiment configs, runners, and templates

* fix: use PropSetting instances instead of class attributes in qlib runners

* docs: add configurable train/valid/test time segments for fintech scenarios
This commit is contained in:
Linlang
2026-01-07 12:49:15 +08:00
committed by GitHub
parent 99a71bf533
commit 19dbeb93e9
13 changed files with 244 additions and 52 deletions
+54
View File
@@ -28,6 +28,24 @@ class ModelBasePropSetting(BasePropSetting):
evolving_n: int = 10
"""Number of evolutions"""
train_start: str = "2008-01-01"
"""Start date of the training segment"""
train_end: str = "2014-12-31"
"""End date of the training segment"""
valid_start: str = "2015-01-01"
"""Start date of the validation segment"""
valid_end: str = "2016-12-31"
"""End date of the validation segment"""
test_start: str = "2017-01-01"
"""Start date of the test / backtest segment"""
test_end: str = "2020-12-31"
"""End date of the test / backtest segment"""
class FactorBasePropSetting(BasePropSetting):
model_config = SettingsConfigDict(env_prefix="QLIB_FACTOR_", protected_namespaces=())
@@ -54,6 +72,24 @@ class FactorBasePropSetting(BasePropSetting):
evolving_n: int = 10
"""Number of evolutions"""
train_start: str = "2008-01-01"
"""Start date of the training segment"""
train_end: str = "2014-12-31"
"""End date of the training segment"""
valid_start: str = "2015-01-01"
"""Start date of the validation segment"""
valid_end: str = "2016-12-31"
"""End date of the validation segment"""
test_start: str = "2017-01-01"
"""Start date of the test / backtest segment"""
test_end: str = "2020-12-31"
"""End date of the test / backtest segment"""
class FactorFromReportPropSetting(FactorBasePropSetting):
# 1) override the scen attribute
@@ -113,6 +149,24 @@ class QuantBasePropSetting(BasePropSetting):
action_selection: str = "bandit"
"""Action selection strategy: 'bandit' for bandit-based selection, 'llm' for LLM-based selection, 'random' for random selection"""
train_start: str = "2008-01-01"
"""Start date of the training segment"""
train_end: str = "2014-12-31"
"""End date of the training segment"""
valid_start: str = "2015-01-01"
"""Start date of the validation segment"""
valid_end: str = "2016-12-31"
"""End date of the validation segment"""
test_start: str = "2017-01-01"
"""Start date of the test / backtest segment"""
test_end: str = "2020-12-31"
"""End date of the test / backtest segment"""
FACTOR_PROP_SETTING = FactorBasePropSetting()
FACTOR_FROM_REPORT_PROP_SETTING = FactorFromReportPropSetting()