Add WeCom markdown alerts and keep target exits while strategy is paused.
Notify open/close/start/pause/fault with SIM vs LIVE venue labels; configure webhook in Settings. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -115,6 +115,22 @@ async def sim_open_group(
|
||||
)
|
||||
if not r.ok:
|
||||
raise HTTPException(status_code=400, detail=r.detail)
|
||||
try:
|
||||
from ..notify import wecom
|
||||
|
||||
wecom.notify_open(
|
||||
group_id=gid,
|
||||
detail=r.detail,
|
||||
extra={
|
||||
"bias": bias,
|
||||
"option_side": option_side,
|
||||
"option_inst_id": option_inst,
|
||||
"strike": pick.pair.strike,
|
||||
"expiry_ymd": pick.pair.expiry_ymd,
|
||||
},
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return {
|
||||
"ok": True,
|
||||
**(r.data or {}),
|
||||
@@ -141,6 +157,16 @@ async def sim_close_group(_user: Annotated[str, Depends(require_user)]) -> dict:
|
||||
if r.ok:
|
||||
# 与自动/紧急全平一致:成功全平后进入组间休息
|
||||
get_engine().enter_rest_after_close()
|
||||
try:
|
||||
from ..notify import wecom
|
||||
|
||||
wecom.notify_close(
|
||||
reason="manual",
|
||||
detail=r.detail,
|
||||
data=r.data or {},
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return {
|
||||
"ok": r.ok,
|
||||
"liquidity_wait": r.liquidity_wait,
|
||||
|
||||
Reference in New Issue
Block a user