From 70841548bcd55437918276f4e827fd85ef85a4bf Mon Sep 17 00:00:00 2001 From: hyowons Date: Thu, 11 Jun 2026 11:08:27 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20VI=20=EB=B0=B0=EC=A7=80=20=ED=86=A0?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=EC=97=90=20=EC=A2=85=EB=AA=A9=20=EC=8B=A4?= =?UTF-8?q?=EC=A0=9C=20VI=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ⚡VI 탭 시 그 종목의 실시간 VI 정보(적용구분·방향·발동가·발동등락률·당일 발동횟수·해제시각)를 설명과 함께 표시. window.__rtState.vi[code] 사용. 허브에 발동횟수(1490) 캡처 추가. Co-Authored-By: Claude Opus 4.8 --- agents/stock/workspace/scripts/behive_web.py | 20 +++++++++++++++++-- .../stock/workspace/scripts/realtime_hub.py | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/agents/stock/workspace/scripts/behive_web.py b/agents/stock/workspace/scripts/behive_web.py index 29c75ef..2e9a44e 100644 --- a/agents/stock/workspace/scripts/behive_web.py +++ b/agents/stock/workspace/scripts/behive_web.py @@ -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; diff --git a/agents/stock/workspace/scripts/realtime_hub.py b/agents/stock/workspace/scripts/realtime_hub.py index 501718a..6a061c6 100644 --- a/agents/stock/workspace/scripts/realtime_hub.py +++ b/agents/stock/workspace/scripts/realtime_hub.py @@ -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(), }