Add key-level auto trade, AI analysis, and trading UX improvements.
Key monitors use 5m close triggers with WeChat alerts and box/convergence auto orders; add pending-order worker, structured WeChat notify, AI settings/messages, session clock, CTP margin sizing, and dual-layer position limits. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -285,6 +285,36 @@ def sync_trade_logs_from_ctp(
|
||||
row_vals + ("ctp", key, 1),
|
||||
)
|
||||
stats["synced"] += 1
|
||||
try:
|
||||
from trade_notify import notify_trade_log_close
|
||||
from trading_context import trading_mode_label
|
||||
from app import get_setting, send_wechat_msg
|
||||
from ai_worker import schedule_ai_event_analysis
|
||||
from db_conn import DB_PATH
|
||||
|
||||
notify_trade_log_close(
|
||||
send_wechat=send_wechat_msg,
|
||||
get_setting=get_setting,
|
||||
mode_label=trading_mode_label(get_setting),
|
||||
capital=capital,
|
||||
sym=ths,
|
||||
symbol_name=codes.get("name") or mon.get("symbol_name") or ths,
|
||||
direction=direction,
|
||||
entry=entry,
|
||||
close_price=close_px,
|
||||
sl=float(sl) if sl is not None else None,
|
||||
tp=float(tp) if tp is not None else None,
|
||||
lots=lots,
|
||||
pnl_net=pnl_net,
|
||||
equity_after=equity_after,
|
||||
holding_minutes=minutes,
|
||||
result=result,
|
||||
monitor_type=monitor_type,
|
||||
schedule_ai_fn=schedule_ai_event_analysis,
|
||||
db_path=DB_PATH,
|
||||
)
|
||||
except Exception as exc:
|
||||
logger.debug("ctp close notify: %s", exc)
|
||||
|
||||
if stats["synced"] or stats["updated"]:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user