diff --git a/agents/stock/workspace/scripts/behive_web.py b/agents/stock/workspace/scripts/behive_web.py index 482bbf9..a5d72d0 100644 --- a/agents/stock/workspace/scripts/behive_web.py +++ b/agents/stock/workspace/scripts/behive_web.py @@ -8938,16 +8938,19 @@ window.openPinModal = openPinModal; }); return Object.keys(s); } + // 종목코드로 행 찾기 — 같은 코드가 바 키(005930·당일매매·관심)와 접미사 키(005930:held·:held:계좌)로 동시 존재. + // 정확매칭만 하면 메인 보유목록(:held)을 놓치므로, 바 키 + "code:" 접두 키를 함께 매칭. + function selByCode(code){ return 'details.row[data-row-key="'+code+'"],details.row[data-row-key^="'+code+':"]'; } function paintPrice(code,q){ // 현재가 숫자 span(.rt-px)만 갱신 — 등락률·매매표시·당일정산(실현손익) 셀은 .rt-px가 없어 자동 제외. - // 값이 바뀔 때만 써서 깜빡임 방지. var t=q.price.toLocaleString(); - document.querySelectorAll('details.row[data-row-key="'+code+'"] .rt-px').forEach(function(el){ - if(el.textContent!==t) el.textContent=t; + document.querySelectorAll(selByCode(code)).forEach(function(r){ + r.querySelectorAll('.rt-px').forEach(function(el){ if(el.textContent!==t) el.textContent=t; }); // 값 바뀔 때만 → 깜빡임 방지 }); } function paintVI(code,active){ - document.querySelectorAll('details.row[data-row-key="'+code+'"] .line1').forEach(function(l1){ + document.querySelectorAll(selByCode(code)).forEach(function(r){ + var l1=r.querySelector('.line1'); if(!l1) return; var b=l1.querySelector('.rt-vi-badge'); if(active && !b){ b=document.createElement('span'); b.className='rt-vi-badge'; b.textContent='⚡VI'; l1.appendChild(b); } else if(!active && b){ b.remove(); } @@ -8959,10 +8962,10 @@ window.openPinModal = openPinModal; // 보유행 평가손익/평가금액 = 현재가×수량 − 매입금액(정밀). 서버 손익 공식과 동일. // data-rt-qty 있는 모든 사본(요약·당일매매·계좌별)에 적용. function paintProfit(code,price){ - document.querySelectorAll('details.row[data-rt-qty][data-row-key="'+code+'"]').forEach(function(r){ + document.querySelectorAll(selByCode(code)).forEach(function(r){ var qty=parseFloat(r.getAttribute('data-rt-qty')||'0'); var cost=parseFloat(r.getAttribute('data-rt-cost')||'0'); - if(!qty||!cost) return; + if(!qty||!cost) return; // 보유행 아닌 사본(관심·감시)은 data-rt-qty/cost 없어 자동 스킵 var ev=price*qty, profit=ev-cost, rate=profit/cost*100; var pf=r.querySelector('.rt-profit'); if(pf) pf.textContent=sgn(profit); var pp=r.querySelector('.rt-profit-pct'); if(pp) pp.textContent=(rate>=0?'+':'')+rate.toFixed(2)+'%'; @@ -8973,8 +8976,8 @@ window.openPinModal = openPinModal; } // 행 등락률·당일등락·평가금액변동 = 현재가 vs NXT 종가(data-rt-prevclose). 화면 표시와 동일 기준(0B의 KRX 등락율 아님). function paintDay(code,price){ - document.querySelectorAll('details.row[data-rt-prevclose][data-row-key="'+code+'"]').forEach(function(r){ - var pc=parseFloat(r.getAttribute('data-rt-prevclose')||'0'); + document.querySelectorAll(selByCode(code)).forEach(function(r){ + var pc=parseFloat(r.getAttribute('data-rt-prevclose')||'0'); // 없는 행(관심·감시)은 0 → 아래서 스킵 var qty=parseFloat(r.getAttribute('data-rt-qty')||'0'); if(pc<=0) return; var dc=price-pc, pct=(price/pc-1)*100, dv=dc*qty; @@ -9039,12 +9042,12 @@ window.openPinModal = openPinModal; window.__rtPx=px; updateScopes(px); // 체결 신호 변화 → 패널 새로고침(수량·예수금·당일정산 등 사건 기반 값). 첫 관측은 기준값만 저장(공회전 방지). - if(d.fill_seq){ - if(window.__rtFillSeq===undefined){ window.__rtFillSeq=d.fill_seq; } - else if(window.__rtFillSeq!==d.fill_seq){ - window.__rtFillSeq=d.fill_seq; - if(window.__behive_load){ window.__behive_load(window.__behive_active_owner?window.__behive_active_owner():null, true); } - } + // 빈 문자열('')도 유효 기준으로 취급 — 신호파일이 비어있다 첫 체결로 채워질 때도 reload 되게. + var fs=d.fill_seq||''; + if(window.__rtFillSeq===undefined){ window.__rtFillSeq=fs; } + else if(window.__rtFillSeq!==fs){ + window.__rtFillSeq=fs; + if(window.__behive_load){ window.__behive_load(window.__behive_active_owner?window.__behive_active_owner():null, true); } } }).catch(function(){}); }