合约详情加入次日预测振幅,取最近5日波幅均值

This commit is contained in:
2026-07-24 22:26:33 +08:00
parent 58e3e98031
commit dce017fbf2
2 changed files with 12 additions and 5 deletions
+6
View File
@@ -79,6 +79,11 @@ def contract_detail(request: Request, contract: str, db: Session = Depends(get_d
latest = bars[0] if bars else None
# Predict next trading day amplitude: mean of latest 5 diffs
next_amp = None
if len(bars) >= 5:
next_amp = round(sum(b.diff for b in bars[:5]) / 5)
template = request.app.state.templates.get_template("contract.html")
return HTMLResponse(
template.render(
@@ -88,6 +93,7 @@ def contract_detail(request: Request, contract: str, db: Session = Depends(get_d
contracts=active_contracts,
rows=rows,
latest=latest,
next_amp=next_amp,
row_count=len(rows),
)
)