Expand recommend table with gap, daily stats, and client-side sorting

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 17:36:31 +08:00
parent a56370d2af
commit b641a4eaa0
6 changed files with 324 additions and 28 deletions
+32 -7
View File
@@ -121,13 +121,24 @@
保证金优先读取 CTP 柜台合约信息。
{% if recommend_updated_at %}<span class="text-muted">每日后台更新 · 最近 {{ recommend_updated_at }}</span>{% else %}<span class="text-muted" id="rec-updated">等待今日后台刷新…</span>{% endif %}
</p>
<p class="trend-hint">走势说明:拉取近一周日线;最近三天 K 线高低价重叠度 ≥ 70% 判为<strong>震荡</strong>,否则按收盘方向判<strong>多头</strong>/<strong>空头</strong>;前段震荡、近期突破则标为<strong>转多</strong>/<strong>转空</strong>并优先排列</p>
<p class="trend-hint">走势:近一周日线,近3日重叠≥70%为震荡;跳空=今日开盘 vs 昨日收盘。支持按走势/跳空/成交量/振幅排序</p>
<div class="rec-sort-bar">
<label for="rec-sort-key">排序</label>
<select id="rec-sort-key">
<option value="trend" selected>走势</option>
<option value="gap">跳空</option>
<option value="volume">成交量</option>
<option value="amplitude">振幅</option>
</select>
<button type="button" class="rec-sort-dir-btn" id="rec-sort-dir" title="切换升序/降序"></button>
</div>
<div class="trade-table-wrap">
<table class="trade-table">
<table class="trade-table" id="recommend-table">
<thead>
<tr>
<th>品种</th><th>交易所</th><th>走势</th><th>参考价</th>
<th>参考止损</th><th>参考止盈</th>
<th>品种</th><th>交易所</th><th>走势</th><th>是否跳空</th>
<th>参考</th><th>昨日收盘</th><th>今日开盘</th>
<th>昨日涨跌</th><th>昨日振幅</th><th>成交量</th>
<th>1手保证金</th><th>1手手续费</th><th>最大手数</th><th>状态</th>
</tr>
</thead>
@@ -144,9 +155,23 @@
</span>
{% else %}—{% endif %}
</td>
<td>
{% if r.gap_label and r.gap_label != '—' %}
<span class="badge gap-badge {% if r.gap == 'up' %}profit{% elif r.gap == 'down' %}loss{% else %}planned{% endif %}"{% if r.gap_pct %} title="跳空 {{ '%+.2f'|format(r.gap_pct) }}%"{% endif %}>{{ r.gap_label }}</span>
{% else %}—{% endif %}
</td>
<td>{% if r.price %}{{ r.price }}{% else %}—{% endif %}</td>
<td>{% if r.ref_stop_loss %}{{ r.ref_stop_loss }}{% else %}—{% endif %}</td>
<td>{% if r.ref_take_profit %}{{ r.ref_take_profit }}{% else %}—{% endif %}</td>
<td>{% if r.prev_close is not none %}{{ r.prev_close }}{% else %}—{% endif %}</td>
<td>{% if r.today_open is not none %}{{ r.today_open }}{% else %}—{% endif %}</td>
<td>
{% if r.yesterday_change is not none %}
<span class="{% if r.yesterday_change > 0 %}rec-change-up{% elif r.yesterday_change < 0 %}rec-change-down{% endif %}">
{{ '%+.4f'|format(r.yesterday_change) }}{% if r.yesterday_change_pct is not none %} ({{ '%+.2f'|format(r.yesterday_change_pct) }}%){% endif %}
</span>
{% else %}—{% endif %}
</td>
<td>{% if r.yesterday_amplitude_pct is not none %}{{ '%.2f'|format(r.yesterday_amplitude_pct) }}%{% else %}—{% endif %}</td>
<td>{% if r.volume is not none %}{{ r.volume }}{% else %}—{% endif %}</td>
<td>{% if r.margin_one_lot %}{{ r.margin_one_lot }}{% if r.margin_source == 'ctp' %} <span class="text-muted">(柜台)</span>{% endif %}{% else %}—{% endif %}</td>
<td>{% if r.open_fee_one_lot is defined and r.open_fee_one_lot is not none %}{{ r.open_fee_one_lot }}{% else %}—{% endif %}</td>
<td>{% if r.max_lots is not none and r.max_lots > 0 %}{{ r.max_lots }}{% else %}—{% endif %}</td>
@@ -154,7 +179,7 @@
</tr>
{% endfor %}
{% else %}
<tr><td colspan="10" class="empty-hint">等待今日后台刷新推荐…</td></tr>
<tr><td colspan="14" class="empty-hint">等待今日后台刷新推荐…</td></tr>
{% endif %}
</tbody>
</table>