fix(strategy): 编辑器代码空白根因=/strategy/files不含code; 加GET /strategy/file/{name}按需拉取; 运行回测改回跳参数页+按策略预填(New.vue读query.class,推翻上轮直接发起) [nas]

This commit is contained in:
2026-08-13 19:40:18 +08:00
parent b9d9285246
commit 82c9edb092
4 changed files with 49 additions and 71 deletions
+9
View File
@@ -34,6 +34,15 @@ def get_files():
return list_strategy_files()
@router.get("/strategy/file/{name}")
def get_file(name: str):
"""读单个策略文件全量(含 code)。"""
try:
return read_strategy_file(name)
except ValueError:
raise HTTPException(status_code=404, detail="策略文件不存在")
@router.post("/strategy/file/{name}")
def post_file(name: str, req: FileWriteRequest):
"""保存策略代码(py_compile 校验,失败 400)。"""