数据同步页增加持仓天数展示,修复持仓同步无法拉取历史数据的问题

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-25 21:52:32 +08:00
parent 9fd0116dec
commit d62304b2c4
3 changed files with 10 additions and 8 deletions
+1 -7
View File
@@ -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: