From 68fbdf556d9fccfb6deab0983d9b048405c83684 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Sun, 12 Apr 2026 10:18:25 +0800 Subject: [PATCH] auto-sync: 2026-04-12 10:18:25 --- logs/auto-sync.log | 1 + scripts/backtest-service/config.py | 32 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 scripts/backtest-service/config.py diff --git a/logs/auto-sync.log b/logs/auto-sync.log index 8fa2a96e..6305ede3 100644 --- a/logs/auto-sync.log +++ b/logs/auto-sync.log @@ -160,5 +160,6 @@ + diff --git a/scripts/backtest-service/config.py b/scripts/backtest-service/config.py new file mode 100644 index 00000000..2e9fe4bc --- /dev/null +++ b/scripts/backtest-service/config.py @@ -0,0 +1,32 @@ +""" +自动化回测服务 - 配置 +""" +from pydantic_settings import BaseSettings + + +class Settings(BaseSettings): + """回测服务配置""" + # 服务监听地址 + host: str = "0.0.0.0" + port: int = 8088 + + # 最大并发回测数(根据CPU核数调整,NAS赛扬建议2) + max_workers: int = 2 + + # 回测任务存储根目录 + base_dir: str = "/app/backtest_jobs" + + # CORS 配置 - 开发环境允许所有来源 + cors_allow_all: bool = True + + # 调试模式 + debug: bool = True + + # 允许策略代码中导入模块 + allow_imports: bool = True + + # 最大回测时间限制(秒),防止无限循环 + max_execution_time: int = 3600 # 1小时 + + +settings = Settings()