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:
@@ -6,10 +6,16 @@ import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
from hub_ohlcv_lib import aggregate_ohlcv_bars
|
||||
from datetime import datetime, timezone
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from hub_symbol_archive_lib import (
|
||||
CHART_DISPLAY_TZ,
|
||||
_fill_missing_bars,
|
||||
init_db,
|
||||
load_symbol_trades,
|
||||
ms_to_wall_clock_str,
|
||||
parse_wall_clock_ms,
|
||||
resolve_archive_chart,
|
||||
upsert_bars_5m,
|
||||
upsert_trade_overlay,
|
||||
@@ -200,3 +206,13 @@ def test_list_with_overlay_filters():
|
||||
assert len(sick_only) == 1
|
||||
profit_only = list_symbol_rows(filter_profit=True, db_path=db)
|
||||
assert len(profit_only) == 1
|
||||
|
||||
|
||||
def test_parse_wall_clock_ms_uses_utc_plus_8():
|
||||
ms = parse_wall_clock_ms("2026-06-07 20:30:00")
|
||||
assert ms is not None
|
||||
dt_utc = datetime.fromtimestamp(ms / 1000.0, tz=timezone.utc)
|
||||
dt_bj = dt_utc.astimezone(CHART_DISPLAY_TZ)
|
||||
assert dt_bj.strftime("%Y-%m-%d %H:%M:%S") == "2026-06-07 20:30:00"
|
||||
assert ms_to_wall_clock_str(ms) == "2026-06-07 20:30:00"
|
||||
assert parse_wall_clock_ms("2026-06-07 20:30") == ms
|
||||
|
||||
Reference in New Issue
Block a user