Sync displayed entry price from CTP exchange position average.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-30 09:19:27 +08:00
parent c8fef65de7
commit f41276806e
3 changed files with 14 additions and 15 deletions
+3
View File
@@ -832,12 +832,15 @@
if (isPhoneLayout() && posMobileCache[key]) {
var cached = posMobileCache[key];
if (q.mark_price != null) cached.current_price = q.mark_price;
if (q.entry_price != null) cached.entry_price = q.entry_price;
if (q.float_pnl != null) cached.float_pnl = q.float_pnl;
}
var row = findPosRow(key);
if (!row) return;
var entryEl = row.querySelector('.dash-p-entry');
var markEl = row.querySelector('.dash-p-mark');
var pnlEl = row.querySelector('.dash-p-pnl');
if (entryEl && q.entry_price != null) entryEl.textContent = fmtNum(q.entry_price);
if (markEl && q.mark_price != null) markEl.textContent = fmtNum(q.mark_price);
if (pnlEl && q.float_pnl != null) {
pnlEl.textContent = fmtPnl(q.float_pnl);
+3 -1
View File
@@ -216,9 +216,11 @@
data.quotes.forEach(function (q) {
var card = findPosCardByKey(q.key || q.position_key);
if (!card) return;
var entryEl = card.querySelector('.pos-q-entry');
var markEl = card.querySelector('.pos-q-mark');
var pnlEl = card.querySelector('.pos-q-pnl');
var pnlWrap = card.querySelector('.pos-q-pnl-wrap');
if (entryEl && q.entry_price != null) entryEl.textContent = fmtNum(q.entry_price);
if (markEl && q.mark_price != null) markEl.textContent = fmtNum(q.mark_price);
if (pnlEl && q.float_pnl != null) {
var pnl = q.float_pnl;
@@ -1204,7 +1206,7 @@
'<div class="pos-card-meta pos-card-meta-line">' + metaLine + '</div>' +
'<div class="pos-metrics">' +
'<div class="cell"><label>手数</label><div><strong>' + row.lots + ' 手</strong></div></div>' +
'<div class="cell"><label>均价</label><div>' + fmtNum(row.entry_price) + '</div></div>' +
'<div class="cell"><label>均价</label><div class="pos-q-entry">' + fmtNum(row.entry_price) + '</div></div>' +
'<div class="cell"><label>当前价格</label><div class="pos-q-mark">' + (row.current_price != null ? fmtNum(row.current_price) : '--') + '</div></div>' +
'<div class="cell"><label>' + marginLabel + '</label><div>' + (row.margin != null ? fmtNum(row.margin) + ' 元' : '--') + '</div></div>' +
'<div class="cell"><label>仓位占比</label><div>' + (row.position_pct != null ? fmtNum(row.position_pct) + '%' : '--') + '</div></div>' +