diff --git a/ft-app/app/routers/contracts.py b/ft-app/app/routers/contracts.py index e927ac0..ccd5b63 100644 --- a/ft-app/app/routers/contracts.py +++ b/ft-app/app/routers/contracts.py @@ -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 "", diff --git a/ft-app/app/templates/contract.html b/ft-app/app/templates/contract.html index 48224ad..f6ed68e 100644 --- a/ft-app/app/templates/contract.html +++ b/ft-app/app/templates/contract.html @@ -92,6 +92,15 @@ {% endfor %} + {% if dtype != 'volume' %} +