合约详情加入次日预测振幅,取最近5日波幅均值
This commit is contained in:
@@ -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),
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user