fix: show archive chart times in UTC+8 and parse Beijing wall clock

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-08 16:47:09 +08:00
parent 947b58084d
commit 55a979eee5
5 changed files with 103 additions and 32 deletions
+2 -13
View File
@@ -48,6 +48,7 @@ from hub_symbol_archive_lib import (
init_db as init_archive_db,
list_symbol_rows,
load_symbol_trades,
parse_wall_clock_ms,
resolve_archive_chart,
sync_exchange_symbol_archives,
upsert_trade_overlay,
@@ -1903,19 +1904,7 @@ def _parse_anchor_ms(at: str = "", anchor_ms: str = "") -> int | None:
raw = (anchor_ms or at or "").strip()
if not raw:
return None
if raw.isdigit():
v = int(raw)
return v if v > 1_000_000_000_000 else v * 1000
s = raw.replace("Z", "").replace("T", " ")
for fmt, ln in (("%Y-%m-%d %H:%M:%S", 19), ("%Y-%m-%d %H:%M", 16), ("%Y-%m-%d", 10)):
try:
from datetime import datetime
dt = datetime.strptime(s[:ln], fmt)
return int(dt.timestamp() * 1000)
except ValueError:
continue
return None
return parse_wall_clock_ms(raw)
@app.get("/api/archive/meta")