fix: UTC+8 market chart times and archive full history K-line load
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -216,3 +216,32 @@ def test_parse_wall_clock_ms_uses_utc_plus_8():
|
||||
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
|
||||
|
||||
|
||||
def test_parse_wall_clock_ms_accepts_epoch_strings():
|
||||
ms = 1_700_000_000_000
|
||||
assert parse_wall_clock_ms(str(ms)) == ms
|
||||
assert parse_wall_clock_ms(str(ms // 1000)) == ms
|
||||
|
||||
|
||||
def test_resolve_archive_chart_history_uses_trade_span_not_200_bars():
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
db = Path(td) / "archive.db"
|
||||
init_db(db)
|
||||
opened = 1_700_000_000_000
|
||||
closed = opened + 20 * 24 * 3600_000
|
||||
_seed_5m_bars(db, opened - 35 * 24 * 3600_000, 40 * 24 * 12)
|
||||
out = resolve_archive_chart(
|
||||
"gate",
|
||||
"ONDO",
|
||||
"15m",
|
||||
opened_ms=opened,
|
||||
closed_ms=closed,
|
||||
mode="hold",
|
||||
bars=200,
|
||||
range_mode="history",
|
||||
db_path=db,
|
||||
)
|
||||
assert out["ok"] is True
|
||||
assert out["range_mode"] == "history"
|
||||
assert out["bar_count"] > 200
|
||||
|
||||
Reference in New Issue
Block a user