Format trade prices to 3 decimals and round on ingest.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-21 10:30:21 +08:00
parent c436b76e64
commit a6062fbacc
4 changed files with 49 additions and 11 deletions
+4 -4
View File
@@ -11,13 +11,13 @@
<tr><th>账户</th><td>{{ trade.account_name or '—' }}</td></tr>
<tr><th>机器</th><td>{{ trade.machine_name or '—' }}</td></tr>
<tr><th>手数</th><td>{{ trade.volume }}</td></tr>
<tr><th>开仓价</th><td>{{ trade.open_price }}</td></tr>
<tr><th>平仓价</th><td>{{ trade.close_price if trade.close_price is not none else '—' }}</td></tr>
<tr><th>开仓价</th><td>{{ trade.open_price|fmt_price }}</td></tr>
<tr><th>平仓价</th><td>{{ trade.close_price|fmt_price }}</td></tr>
<tr><th>开仓时间</th><td>{{ trade.open_time_fmt }} <span class="muted">北京时间</span></td></tr>
<tr><th>平仓时间</th><td>{{ trade.close_time_fmt }} <span class="muted">北京时间</span></td></tr>
<tr><th>持仓时间</th><td style="font-weight:700;color:var(--accent)">{{ trade.hold_duration }}</td></tr>
<tr><th>盈亏</th><td>{{ trade.profit }}</td></tr>
<tr><th>SL / TP</th><td>{{ trade.sl }} / {{ trade.tp }}</td></tr>
<tr><th>盈亏</th><td>{{ trade.profit|fmt_money }}</td></tr>
<tr><th>SL / TP</th><td>{{ trade.sl|fmt_price }} / {{ trade.tp|fmt_price }}</td></tr>
<tr><th>单号</th><td>{{ trade.ticket or '—' }}</td></tr>
</table>
</div>
+3 -3
View File
@@ -56,10 +56,10 @@
<td>{{ t.symbol }}</td>
<td><span class="tag {% if t.side=='buy' %}green{% else %}red{% endif %}">{{ t.side }}</span></td>
<td>{{ t.volume }}</td>
<td>{{ t.open_price }}</td>
<td>{{ t.close_price if t.close_price is not none else '—' }}</td>
<td>{{ t.open_price|fmt_price }}</td>
<td>{{ t.close_price|fmt_price }}</td>
<td style="color:{% if t.profit and t.profit>0 %}var(--green){% elif t.profit and t.profit<0 %}var(--red){% else %}inherit{% endif %}">
{{ t.profit if t.profit is not none else '—' }}
{{ t.profit|fmt_money }}
</td>
<td class="muted" style="white-space:nowrap">{{ t.open_time_fmt }}</td>
<td class="muted" style="white-space:nowrap">{{ t.close_time_fmt }}</td>