fix: 修正 d.minute() 调用导致盘前连接 worker 报错。
datetime.minute 是属性而非方法,修复后交易时段与盘前自动连 CTP 可正常工作。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+1
-1
@@ -29,7 +29,7 @@ def is_trading_session() -> bool:
|
|||||||
return False
|
return False
|
||||||
if wd == 5 and d.hour < 21:
|
if wd == 5 and d.hour < 21:
|
||||||
return False
|
return False
|
||||||
t = d.hour * 60 + d.minute()
|
t = d.hour * 60 + d.minute
|
||||||
def in_range(sh: int, sm: int, eh: int, em: int) -> bool:
|
def in_range(sh: int, sm: int, eh: int, em: int) -> bool:
|
||||||
return t >= sh * 60 + sm and t < eh * 60 + em
|
return t >= sh * 60 + sm and t < eh * 60 + em
|
||||||
if in_range(9, 0, 11, 30):
|
if in_range(9, 0, 11, 30):
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ def is_trading_session(now: Optional[datetime] = None) -> bool:
|
|||||||
return False
|
return False
|
||||||
if wd == 5 and d.hour < 21:
|
if wd == 5 and d.hour < 21:
|
||||||
return False
|
return False
|
||||||
t = d.hour * 60 + d.minute()
|
t = d.hour * 60 + d.minute
|
||||||
def in_range(sh: int, sm: int, eh: int, em: int) -> bool:
|
def in_range(sh: int, sm: int, eh: int, em: int) -> bool:
|
||||||
return t >= sh * 60 + sm and t < eh * 60 + em
|
return t >= sh * 60 + sm and t < eh * 60 + em
|
||||||
if in_range(9, 0, 11, 30):
|
if in_range(9, 0, 11, 30):
|
||||||
|
|||||||
Reference in New Issue
Block a user