From d62304b2c477ad74c402f0fb8a19157c395e511f Mon Sep 17 00:00:00 2001 From: fish Date: Sat, 25 Jul 2026 21:52:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5=E9=A1=B5?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8C=81=E4=BB=93=E5=A4=A9=E6=95=B0=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=8C=81=E4=BB=93=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E6=97=A0=E6=B3=95=E6=8B=89=E5=8F=96=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- ft-app/app/collector.py | 8 +------- ft-app/app/routers/admin.py | 7 +++++++ ft-app/app/templates/admin.html | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ft-app/app/collector.py b/ft-app/app/collector.py index 17f73b0..0c0e4db 100644 --- a/ft-app/app/collector.py +++ b/ft-app/app/collector.py @@ -113,13 +113,7 @@ def sync_positions_bg(contract_code: str) -> bool: .filter(DailyBar.contract == code) .order_by(DailyBar.date).all() ] - # Only sync dates within or after existing position date range; - # akshare may not have data for very old dates - if existing_dates: - min_pos = min(existing_dates) - missing = [d for d in bar_dates if d not in existing_dates and d >= min_pos] - else: - missing = [d for d in bar_dates if d not in existing_dates] + missing = [d for d in bar_dates if d not in existing_dates] total_missing = len(missing) with _lock: diff --git a/ft-app/app/routers/admin.py b/ft-app/app/routers/admin.py index 7103493..dac777e 100644 --- a/ft-app/app/routers/admin.py +++ b/ft-app/app/routers/admin.py @@ -31,9 +31,16 @@ def admin_page(request: Request, db: Session = Depends(get_db)): .filter(DailyBar.contract == c.code) .count() ) + pos_days = len({ + r[0] for r in + db.query(PositionRanking.date) + .filter(PositionRanking.contract_code == c.code) + .distinct().all() + }) contract_list.append({ "id": c.id, "code": c.code, "name": c.name, "is_active": c.is_active, "bar_count": bar_count, + "pos_days": pos_days, }) product_data.append({ diff --git a/ft-app/app/templates/admin.html b/ft-app/app/templates/admin.html index 7c2aa0f..dd0b236 100644 --- a/ft-app/app/templates/admin.html +++ b/ft-app/app/templates/admin.html @@ -59,11 +59,12 @@