feat: VI 배지 토스트에 종목 실제 VI 데이터 표시

VI 탭 시 그 종목의 실시간 VI 정보(적용구분·방향·발동가·발동등락률·당일
발동횟수·해제시각)를 설명과 함께 표시. window.__rtState.vi[code] 사용.
허브에 발동횟수(1490) 캡처 추가.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hyowons
2026-06-11 11:08:27 +09:00
parent ae83deab9f
commit 70841548bc
2 changed files with 19 additions and 2 deletions
+18 -2
View File
@@ -9352,12 +9352,28 @@ window.openPinModal = openPinModal;
if(window.showToast) window.showToast(msg, ok?'success':'info');
});
})();
// VI 배지 변동성완화장치 설명 토스트. 배지는 동적 생성이라 document 위임. (details) 토글은 막음.
// VI 배지 종목 실제 VI 데이터 + 설명 토스트. 배지는 동적 생성이라 document 위임. 토글은 막음.
function _fmtViTime(t){ return (t&&t.length>=6)?(t.slice(0,2)+':'+t.slice(2,4)+':'+t.slice(4,6)):(t||''); }
document.addEventListener('click',function(e){
var b=(e.target&&e.target.closest)?e.target.closest('.rt-vi-badge'):null;
if(!b)return;
e.preventDefault();e.stopPropagation();
if(window.showToast)window.showToast('⚡VI (변동성완화장치)\n\n주가가 짧은 시간에 급변하면 약 2분간\n단일가매매로 전환해 과열을 식히는 장치예요.\n\n• 동적VI: 직전 체결가 대비\n• 정적VI: 당일 기준가 대비\n(코스피200 3%·그 외 6% 등에서 발동)','info',7000);
if(!window.showToast)return;
var row=b.closest('details.row');
var code=row?((row.getAttribute('data-row-key')||'').split(':')[0]):'';
var v=(window.__rtState&&window.__rtState.vi)?window.__rtState.vi[code]:null;
var head='';
if(v){
var L=['⚡VI 발동'+(v.apply_kind?(' · '+v.apply_kind):'')];
if(v.direction) L.push('방향: '+(v.direction==='1'?'상승 ▲':(v.direction==='2'?'하락 ▼':v.direction)));
if(v.trigger_price) L.push('발동가: '+Number(v.trigger_price).toLocaleString()+'');
if(v.trigger_pct!=null&&v.trigger_pct!==0) L.push('발동 등락률: '+(v.trigger_pct>=0?'+':'')+v.trigger_pct+'%');
if(v.count) L.push('당일 발동: '+v.count+'');
if(v.release_time) L.push('해제 예정: '+_fmtViTime(v.release_time));
head=L.join('\n')+'\n\n─────\n';
}
var desc='⚡VI (변동성완화장치)\n\n주가가 짧은 시간에 급변하면 약 2분간\n단일가매매로 전환해 과열을 식히는 장치예요.\n\n• 동적VI: 직전 체결가 대비\n• 정적VI: 당일 기준가 대비\n(코스피200 3%·그 외 6% 등에서 발동)';
window.showToast(head+desc,'info',8000);
});
function tick(){
if(document.hidden) return;
@@ -338,6 +338,7 @@ class RealtimeHub:
'trigger_pct': kc._to_float(vals.get('1489')),
'release_time': (vals.get('1224') or '').strip(),
'direction': (vals.get('9069') or '').strip(),
'count': kc._to_int(vals.get('1490')), # 당일 VI 발동 횟수
'ts': datetime.now(KST).isoformat(),
}