From 532ce76e4fa3149b0f6f1f7442c4289e5f11d29a Mon Sep 17 00:00:00 2001 From: xbfighting Date: Sat, 28 Mar 2026 00:32:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=86=E9=92=9F=E7=BA=BF=E5=A2=9E?= =?UTF-8?q?=E9=87=8F=E6=9F=A5=E8=AF=A2=20code=20=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E5=8C=B9=E9=85=8D=E5=AF=BC=E8=87=B4=E5=85=A8=E9=87=8F?= =?UTF-8?q?=E9=87=8D=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit get_latest_datetime_by_code 用 'sz000001' 查询但 DB 存储的是 '000001', 导致每次返回 None,所有股票都全量处理。修复为截取纯 6 位数字后查询。 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cli.py b/src/cli.py index 195396b..5acfa5b 100644 --- a/src/cli.py +++ b/src/cli.py @@ -40,9 +40,12 @@ def sync_single_stock_min_data( start_date: 开始日期 incremental: 是否启用精确增量 """ + # DB 中 code 为纯 6 位数字(reader 写入时会截取),查询时需匹配 + db_code = code[-6:] if len(code) > 6 else code + # 精确增量:查询该股票的最新日期 if incremental and not start_date: - latest = storage.get_latest_datetime_by_code('minute5_data', code) + latest = storage.get_latest_datetime_by_code('minute5_data', db_code) if latest: start_date = (latest + timedelta(days=1)).strftime('%Y-%m-%d') logger.debug(f"{code} 增量起始日期: {start_date}")