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 @@