Fix empty recommend list and CTP premarket auto-connect.
Correct main_code order in product refresh, refresh on CTP connect, and limit reconnect to trading or premarket windows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -122,6 +122,7 @@ from vnpy_bridge import (
|
||||
get_bridge,
|
||||
set_position_refresh_callback,
|
||||
set_tick_sl_tp_callback,
|
||||
set_ctp_connected_callback,
|
||||
)
|
||||
|
||||
|
||||
@@ -1587,6 +1588,7 @@ def install_trading(app, *, login_required, require_nav, get_db, get_setting, se
|
||||
lambda: _push_position_snapshot_async(fast=True)
|
||||
)
|
||||
set_tick_sl_tp_callback(_on_tick_sl_tp)
|
||||
set_ctp_connected_callback(_on_ctp_connected)
|
||||
|
||||
def _warm() -> None:
|
||||
try:
|
||||
@@ -1608,6 +1610,11 @@ def install_trading(app, *, login_required, require_nav, get_db, get_setting, se
|
||||
except Exception as exc:
|
||||
logger.debug("bootstrap ctp connect: %s", exc)
|
||||
|
||||
def _on_ctp_connected(mode: str) -> None:
|
||||
if mode != get_trading_mode(get_setting):
|
||||
return
|
||||
_schedule_recommend_refresh()
|
||||
|
||||
@app.route("/trade")
|
||||
@login_required
|
||||
def trade_page():
|
||||
|
||||
Reference in New Issue
Block a user