持仓排名多空增加增减合计行

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-26 15:06:33 +08:00
parent b421945b16
commit 6c54a8ae95
2 changed files with 17 additions and 0 deletions
+8
View File
@@ -164,6 +164,13 @@ def contract_detail(
"change": r.change,
})
pos_totals = {
"long": sum(r.change for r in rankings if r.data_type == "long"),
"short": sum(r.change for r in rankings if r.data_type == "short"),
}
else:
pos_totals = {"long": 0, "short": 0}
# Predict next trading day amplitude: mean of latest 5 diffs
# Compute next trading date
next_date = latest.date + timedelta(days=1) if latest else None
@@ -186,6 +193,7 @@ def contract_detail(
pos_dates=pos_dates,
selected_pos_date=selected_date,
pos_data=pos_data,
pos_totals=pos_totals,
next_amp=next_amp,
next_date=next_date.strftime("%Y/%-m/%-d") if next_date else None,
next_weekday=WEEKDAY_ZH.get(next_date.weekday(), "") if next_date else "",