Allow scheduled CTP connect when auto-connect setting is off.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,7 +12,6 @@ import threading
|
||||
import time
|
||||
from typing import Callable
|
||||
|
||||
from ctp_settings import is_ctp_auto_connect_enabled
|
||||
from market_sessions import in_premarket_connect_window, is_trading_session
|
||||
from vnpy_bridge import ctp_start_connect, ctp_status
|
||||
|
||||
@@ -60,10 +59,7 @@ def start_ctp_premarket_connect_worker(
|
||||
while True:
|
||||
sleep_sec = max(30, interval)
|
||||
try:
|
||||
gs = get_setting_fn
|
||||
if gs is None:
|
||||
from fee_specs import get_setting as gs
|
||||
if is_ctp_auto_connect_enabled(gs) and should_auto_connect_now():
|
||||
if should_auto_connect_now():
|
||||
mode = get_mode_fn()
|
||||
st = ctp_status(mode)
|
||||
if (
|
||||
@@ -71,7 +67,7 @@ def start_ctp_premarket_connect_worker(
|
||||
and not st.get("connecting")
|
||||
and int(st.get("login_cooldown_sec") or 0) <= 0
|
||||
):
|
||||
info = ctp_start_connect(mode, force=False)
|
||||
info = ctp_start_connect(mode, force=False, scheduled=True)
|
||||
if info.get("started"):
|
||||
if is_trading_session():
|
||||
logger.info("交易时段内自动连接 CTP [%s]", mode)
|
||||
|
||||
Reference in New Issue
Block a user