修复期权开平仓时间按 UTC 入库导致复盘K线标记偏8小时:统一业务时区并一次性迁移。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user