feat(live): 组合策略实盘(R3-1): live_accounts加strategy_type/pool/max_pool/benchmark列(ALTER迁移); supervisor对组合行拉runner_live子进程(env传参+崩溃检测); runner_live重写适配bullet_trade 0.9.2新API(strategy_file+broker_factory,旧initialize=/broker=已废弃)+live_strategy.py适配文件挂StrategyTemplate; 前端live/New双卡表单+列表组合徽标; 8测试 [vps]
This commit is contained in:
@@ -48,6 +48,11 @@ class LiveCreateRequest(BaseModel):
|
||||
connect_wait_sec: int = 10
|
||||
init_wait_sec: int = 60
|
||||
mini_path: str = ""
|
||||
# 组合实盘(strategy_type='portfolio'):strategy_class 存组合策略名(all_weather 等)
|
||||
strategy_type: str = "cta"
|
||||
pool: str = ""
|
||||
max_pool: int = 0
|
||||
benchmark: str = ""
|
||||
|
||||
|
||||
@router.post("/live/create", dependencies=[Depends(verify_token)])
|
||||
@@ -58,6 +63,15 @@ def create_live(req: LiveCreateRequest):
|
||||
db = _db_path["path"] or ":memory:"
|
||||
init_db(db)
|
||||
payload = req.model_dump()
|
||||
if payload.get("strategy_type") == "portfolio":
|
||||
# 组合实盘:vt_symbol 占位为池名;setting 存组合参数(supervisor 转发 env)
|
||||
if not payload.get("strategy_class"):
|
||||
raise HTTPException(400, "组合实盘需选择策略(strategy_class)")
|
||||
payload.setdefault("pool", "hs300_subset")
|
||||
payload.setdefault("max_pool", 30)
|
||||
payload.setdefault("benchmark", "000300.XSHG")
|
||||
payload["vt_symbol"] = payload["pool"]
|
||||
payload["interval"] = "d"
|
||||
# mini_path 兜底:req → env SANGUO_QMT_PATH → 内置默认(空值会导致 connect=-1)
|
||||
if not payload.get("mini_path"):
|
||||
payload["mini_path"] = (
|
||||
|
||||
Reference in New Issue
Block a user