修复期权开平仓时间按 UTC 入库导致复盘K线标记偏8小时:统一业务时区并一次性迁移。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-09-15 11:20:39 +08:00
parent 0132ca4ca1
commit 72ad8ea7dc
8 changed files with 245 additions and 40 deletions
+3 -9
View File
@@ -214,16 +214,10 @@ def option_history_row_key(
def _ms_to_iso(ms: Any) -> str | None:
val = _safe_float(ms)
if val is None or val <= 0:
return None
try:
from datetime import datetime, timezone
"""OKX ms → 业务时区墙钟(默认 Asia/Shanghai);勿用系统本地时区."""
from lib.options.options_time_lib import ms_to_options_app_str
dt = datetime.fromtimestamp(int(val) / 1000.0, tz=timezone.utc).astimezone()
return dt.strftime("%Y-%m-%d %H:%M:%S")
except (TypeError, ValueError, OSError):
return None
return ms_to_options_app_str(ms)
def option_instrument_meta_cached(