feat: 修改委托后展示最新风险,四所持仓卡增加张数
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -429,6 +429,7 @@
|
||||
<span class="pos-meta-item">来源: {{ o.monitor_type|default('下单监控', true) }}{% if o.key_signal_type %} · {{ o.key_signal_type }}{% endif %}</span>
|
||||
<span class="pos-meta-item">风格: {{ o.trade_style or 'trend' }}</span>
|
||||
<span class="pos-meta-item">风险: {% if position_sizing_mode == 'full_margin' %}{{ funds_fmt(o.risk_amount) if o.risk_amount is not none else '-' }}U{% else %}{{ o.risk_percent or '-' }}%≈{{ funds_fmt(o.risk_amount) if o.risk_amount is not none else '-' }}U{% endif %}</span>
|
||||
<span class="pos-meta-item" id="order-latest-risk-wrap-{{ o.id }}" style="display:none">最新风险: —</span>
|
||||
<span class="pos-meta-item {% if o.breakeven_enabled %}pos-meta-on{% else %}pos-meta-off{% endif %}">
|
||||
{% if o.breakeven_enabled %}移动保本:开 {{ o.breakeven_rr_trigger or '-' }}R→{{ price_fmt(o.symbol, o.breakeven_price) }}{% else %}移动保本:关{% endif %}
|
||||
</span>
|
||||
@@ -451,6 +452,10 @@
|
||||
<span class="pos-label">盈亏比</span>
|
||||
<span class="pos-value" id="order-rr-{{ o.id }}">{% if o.rr_ratio is not none %}{{ '%g'|format(o.rr_ratio) }}:1{% else %}-:1{% endif %}</span>
|
||||
</div>
|
||||
<div class="pos-cell">
|
||||
<span class="pos-label">张数</span>
|
||||
<span class="pos-value" id="order-contracts-{{ o.id }}">{% if o.order_amount is not none %}{{ '%g'|format(o.order_amount) }}{% else %}—{% endif %}</span>
|
||||
</div>
|
||||
<div class="pos-cell">
|
||||
<span class="pos-label">标记价</span>
|
||||
<span class="pos-value" id="order-price-{{ o.id }}">-</span>
|
||||
@@ -1663,6 +1668,13 @@ function submitTpslEntrust(){
|
||||
alert(data.msg || '已提交');
|
||||
closeTpslEntrustModal();
|
||||
if(data.exchange_tpsl) paintExchangeTpslRow(orderId, data.exchange_tpsl);
|
||||
paintPlanTpslDisplay(orderId, data);
|
||||
paintLatestRiskDisplay(orderId, data);
|
||||
const rrEl = document.getElementById(`order-rr-${orderId}`);
|
||||
if(rrEl){
|
||||
const rr = data.display_rr_ratio != null && data.display_rr_ratio !== "" ? data.display_rr_ratio : data.planned_rr;
|
||||
rrEl.innerText = formatRrRatio(rr);
|
||||
}
|
||||
refreshPriceSnapshotConditional();
|
||||
}).catch(()=>alert('委托请求失败'));
|
||||
}
|
||||
@@ -1730,6 +1742,25 @@ function paintPlanTpslDisplay(orderId, snap){
|
||||
else if(tpDisp) card.setAttribute("data-plan-tp", tpDisp);
|
||||
}
|
||||
}
|
||||
function paintLatestRiskDisplay(orderId, snap){
|
||||
const wrap = document.getElementById(`order-latest-risk-wrap-${orderId}`);
|
||||
if(!wrap) return;
|
||||
const v = snap && snap.latest_risk_amount;
|
||||
const n = v != null && v !== "" ? Number(v) : NaN;
|
||||
if(Number.isFinite(n)){
|
||||
wrap.style.display = "inline-flex";
|
||||
wrap.textContent = `最新风险: ${n.toFixed(2)}U`;
|
||||
} else {
|
||||
wrap.style.display = "none";
|
||||
}
|
||||
}
|
||||
function paintContractsDisplay(orderId, snap){
|
||||
const el = document.getElementById(`order-contracts-${orderId}`);
|
||||
if(!el || !snap) return;
|
||||
const v = snap.contracts != null && snap.contracts !== "" ? snap.contracts : snap.order_amount;
|
||||
const n = v != null && v !== "" ? Number(v) : NaN;
|
||||
el.innerText = Number.isFinite(n) ? String(parseFloat(n.toFixed(4))) : "—";
|
||||
}
|
||||
|
||||
function paintPriceTrend(el, key, value){
|
||||
if(!el) return;
|
||||
@@ -1813,8 +1844,11 @@ function refreshPriceSnapshot(){
|
||||
}
|
||||
const rrEl = document.getElementById(`order-rr-${o.id}`);
|
||||
if(rrEl){
|
||||
rrEl.innerText = formatRrRatio(o.rr_ratio);
|
||||
const rr = o.display_rr_ratio != null && o.display_rr_ratio !== "" ? o.display_rr_ratio : o.rr_ratio;
|
||||
rrEl.innerText = formatRrRatio(rr);
|
||||
}
|
||||
paintLatestRiskDisplay(o.id, o);
|
||||
paintContractsDisplay(o.id, o);
|
||||
paintBreakevenBadge(o.id, o.sl_breakeven_secured);
|
||||
if(o.exchange_tpsl) paintExchangeTpslRow(o.id, o.exchange_tpsl);
|
||||
paintPlanTpslDisplay(o.id, o);
|
||||
|
||||
Reference in New Issue
Block a user