enhance boot check to include factor calculation during data ingestion
This commit is contained in:
parent
ac408a25ca
commit
393a40cb79
@ -43,23 +43,32 @@ def run_boot_check(
|
|||||||
progress_hook: Callable[[str, float], None] | None = None,
|
progress_hook: Callable[[str, float], None] | None = None,
|
||||||
force_refresh: bool | None = None,
|
force_refresh: bool | None = None,
|
||||||
) -> CoverageReport:
|
) -> CoverageReport:
|
||||||
"""执行开机自检,必要时自动补数据。"""
|
"""执行开机自检,必要时自动补数据并计算因子。"""
|
||||||
|
|
||||||
initialize_database()
|
initialize_database()
|
||||||
start, end = _default_window(days)
|
start, end = _default_window(days)
|
||||||
LOGGER.info("开机检查覆盖窗口:%s 至 %s", start, end)
|
LOGGER.info("开机检查覆盖窗口:%s 至 %s", start, end)
|
||||||
|
|
||||||
|
from app.ingest.tushare import FetchJob, run_ingestion
|
||||||
|
|
||||||
|
# 创建数据拉取任务,这样会自动触发因子计算
|
||||||
|
job = FetchJob(
|
||||||
|
name="ui_auto_update",
|
||||||
|
start=start,
|
||||||
|
end=end,
|
||||||
|
granularity="daily", # 使用日线数据以触发因子计算
|
||||||
|
)
|
||||||
|
|
||||||
refresh = force_refresh
|
refresh = force_refresh
|
||||||
if refresh is None:
|
if refresh is None:
|
||||||
refresh = get_config().force_refresh
|
refresh = get_config().force_refresh
|
||||||
|
|
||||||
if auto_fetch:
|
if auto_fetch:
|
||||||
ensure_data_coverage(
|
# 使用 run_ingestion 来确保数据和因子都被更新
|
||||||
start,
|
if progress_hook:
|
||||||
end,
|
progress_hook("开始更新数据和计算因子...", 0.0)
|
||||||
force=refresh,
|
|
||||||
progress_hook=progress_hook,
|
run_ingestion(job, include_limits=True)
|
||||||
)
|
|
||||||
|
|
||||||
coverage = collect_data_coverage(start, end)
|
coverage = collect_data_coverage(start, end)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user