fix: 开仓时间读CTP OpenDate,止盈止损持久化且重启不丢失

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 15:05:58 +08:00
parent 7daed9bd3a
commit 4d60b958ce
4 changed files with 130 additions and 38 deletions
+2 -2
View File
@@ -77,8 +77,8 @@ def today_str() -> str:
def calc_holding_duration(open_time: str, close_time: str) -> str:
try:
o = datetime.fromisoformat(open_time.strip())
c = datetime.fromisoformat(close_time.strip())
o = datetime.fromisoformat(open_time.strip().replace(" ", "T")[:19])
c = datetime.fromisoformat(close_time.strip().replace(" ", "T")[:19])
delta = c - o
if delta.total_seconds() < 0:
return ""