Add AI trading supervisor with WeChat push and daily session
Proactive monitoring for manual/hub closes and new opens prevents overtrading via in-app alerts, configurable WeChat links, and supervisor chat. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -174,6 +174,59 @@ ARCHIVE_QUOTE_REVIEW_INSTRUCTION = """
|
||||
""".strip()
|
||||
|
||||
|
||||
SUPERVISOR_SYSTEM = """
|
||||
你是交易监管值班员,职责是防止过度交易与频繁手动操作。用中文、短句、克制语气。
|
||||
|
||||
规则:
|
||||
- 只依据提供的结构化事件与账户快照说话;禁止预测涨跌、保证收益。
|
||||
- **手动平仓、中控平仓、新开仓**:指出频率、间隔、是否偏急;提醒休息,不训斥。
|
||||
- **程序止盈/程序止损**:肯定按计划执行,鼓励保持纪律,提醒别立刻反手再开。
|
||||
- 不替用户做决定,不暗示绕过实例冷静期/日冻结。
|
||||
- 每次 1~3 句,必须写完整;禁止长清单和「第1点第2点」。
|
||||
- 实例已进入冷静期/日冻结时,明确说明状态,建议暂停手动开平。
|
||||
""".strip()
|
||||
|
||||
|
||||
def build_supervisor_ai_prompt(
|
||||
*,
|
||||
context_text: str,
|
||||
trading_day: str,
|
||||
event: dict,
|
||||
warnings: list[dict],
|
||||
) -> str:
|
||||
warn_lines = "\n".join(f"- {w.get('message')}" for w in (warnings or []) if w.get("message"))
|
||||
parts = [
|
||||
f"【交易日】{trading_day}",
|
||||
"【监管事件】",
|
||||
str(event or {}),
|
||||
"【当前多账户快照】",
|
||||
(context_text or "(无)").strip(),
|
||||
]
|
||||
if warn_lines.strip():
|
||||
parts.extend(["【已触发频率警告】", warn_lines.strip()])
|
||||
parts.append("请给出 1~3 句监管评语:")
|
||||
return "\n\n".join(parts)
|
||||
|
||||
|
||||
def build_supervisor_chat_prompt(
|
||||
*,
|
||||
context_text: str,
|
||||
trading_day: str,
|
||||
history_lines: str,
|
||||
user_message: str,
|
||||
) -> str:
|
||||
parts = [f"【交易日】{trading_day}"]
|
||||
if history_lines.strip():
|
||||
parts.extend(["【今日监管对话】", history_lines.strip()])
|
||||
parts.extend([
|
||||
"【当前多账户快照】",
|
||||
(context_text or "(无)").strip(),
|
||||
"【用户现在说】",
|
||||
user_message.strip(),
|
||||
])
|
||||
return "\n\n".join(parts)
|
||||
|
||||
|
||||
def build_archive_quote_review_prompt(
|
||||
*,
|
||||
quote_date: str,
|
||||
|
||||
Reference in New Issue
Block a user