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:
dekun
2026-06-28 10:36:56 +08:00
parent 0109b59f27
commit 840e88daad
33 changed files with 2514 additions and 143 deletions
+39
View File
@@ -0,0 +1,39 @@
{# Copyright (c) 2025-2026 马建军. All rights reserved. 专有软件,详见 LICENSE.zh-CN.txt #}
{% extends "base.html" %}
{% block title %}AI 消息 - 国内期货 · 交易复盘系统{% endblock %}
{% block extra_css %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/ai_messages.css') }}">
{% endblock %}
{% block content %}
<div class="card ai-page">
<h2>AI 分析 · 使用说明</h2>
<div class="card-body">
<details class="ai-usage" open>
<summary>使用说明</summary>
<div class="ai-usage-body">
<ul>
<li><a href="{{ url_for('settings') }}">系统设置</a> →「AI 分析 · 使用说明」中配置 Ollama 或 OpenAI 并启用</li>
<li><strong>开仓 / 平仓</strong>:成交后自动生成简要复盘(本页下方列表)</li>
<li><strong>日终报告</strong>:每个交易日按设定时刻汇总当日盈亏与持仓</li>
<li>配置企业微信后,日终报告摘要会同步推送到群</li>
</ul>
</div>
</details>
<h3 class="ai-section-label">分析消息</h3>
<div class="ai-msg-list card-scroll">
{% for m in messages %}
<article class="ai-msg" data-kind="{{ m.kind }}">
<header class="ai-msg-head">
<span class="ai-msg-kind">{{ m.kind }}</span>
<time>{{ m.created_at }}</time>
</header>
{% if m.title %}<h3 class="ai-msg-title">{{ m.title }}</h3>{% endif %}
<pre class="ai-msg-body">{{ m.content }}</pre>
</article>
{% else %}
<p class="text-muted empty-hint">暂无 AI 消息。开启 AI 并完成一笔交易,或等待日终报告后此处会显示分析。</p>
{% endfor %}
</div>
</div>
</div>
{% endblock %}