feat: 분봉 전일대비% 항상 표시 + 보유 상세 종목명 + 유형 폭 정리
- 분봉 차트(1/5/15m): prev_close를 일봉 캐시에서 못 찾으면 ka10095(현재가−전일대비)로 보강 → 모든 종목에 '전일대비 +X%'(오늘 하루 등락) 항상 표시. - 보유종목 자세히 보기 상단에 종목명+코드(.detail-name) 추가. - 차트 컨트롤 2번째 줄: 연도/월은 내용 크기, 유형은 기간과 동일 폭(글씨 크기 유지). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2745,6 +2745,7 @@ def _render_holding_row(r: dict, total_value: int, show_day_change: bool = False
|
|||||||
{candle_summary}
|
{candle_summary}
|
||||||
</summary>
|
</summary>
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
|
<div class="detail-name">{stock}{f'<span class="detail-code">{code}</span>' if code else ''}</div>
|
||||||
{f'<div class="detail-tag">{tag_chip}</div>' if tag_chip else ''}
|
{f'<div class="detail-tag">{tag_chip}</div>' if tag_chip else ''}
|
||||||
<dl>{dl_inner}</dl>
|
<dl>{dl_inner}</dl>
|
||||||
<dl class="pl-summary">{pl_dl_inner}</dl>
|
<dl class="pl-summary">{pl_dl_inner}</dl>
|
||||||
@@ -4212,6 +4213,8 @@ details.row + .section-label { margin-top: 14px; padding-top: 24px; border-top-c
|
|||||||
.tag-chip { display: inline-block; padding: 0 4px; border-radius: 3px; font-size: 8.5px; font-weight: 500; line-height: 1.4; color: #d6b34a; background: rgba(214,179,74,0.10); border: 1px solid rgba(214,179,74,0.30); white-space: nowrap; flex: none; letter-spacing: 0.01em; font-family: inherit; pointer-events: none; user-select: none; }
|
.tag-chip { display: inline-block; padding: 0 4px; border-radius: 3px; font-size: 8.5px; font-weight: 500; line-height: 1.4; color: #d6b34a; background: rgba(214,179,74,0.10); border: 1px solid rgba(214,179,74,0.30); white-space: nowrap; flex: none; letter-spacing: 0.01em; font-family: inherit; pointer-events: none; user-select: none; }
|
||||||
.tag-chip.tag-leader { color: #ff6b78; background: rgba(255,77,94,0.12); border-color: rgba(255,77,94,0.42); font-weight: 600; }
|
.tag-chip.tag-leader { color: #ff6b78; background: rgba(255,77,94,0.12); border-color: rgba(255,77,94,0.42); font-weight: 600; }
|
||||||
/* 펼친 detail의 태그는 크게 (미리보기·관심행 칩은 작게 유지). */
|
/* 펼친 detail의 태그는 크게 (미리보기·관심행 칩은 작게 유지). */
|
||||||
|
.detail-name { font-size: 15px; font-weight: 700; color: #f0f0f0; margin: 0 0 8px; display: flex; align-items: baseline; gap: 8px; }
|
||||||
|
.detail-name .detail-code { font-size: 11px; font-weight: 500; color: #8b8f9a; font-variant-numeric: tabular-nums; }
|
||||||
.detail-tag { margin: 0 0 8px; }
|
.detail-tag { margin: 0 0 8px; }
|
||||||
.detail-tag .tag-chip { font-size: 11px; padding: 2px 8px; border-radius: 4px; }
|
.detail-tag .tag-chip { font-size: 11px; padding: 2px 8px; border-radius: 4px; }
|
||||||
.btn-add-tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 500; line-height: 1.5; color: #5a5f6c; background: transparent; border: 1px dashed rgba(120,124,135,0.30); white-space: nowrap; flex: none; cursor: pointer; font-family: inherit; }
|
.btn-add-tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 500; line-height: 1.5; color: #5a5f6c; background: transparent; border: 1px dashed rgba(120,124,135,0.30); white-space: nowrap; flex: none; cursor: pointer; font-family: inherit; }
|
||||||
@@ -4993,6 +4996,10 @@ table.market-adr td.adr-breakdown { font-size: 11px; color: #8b8f9a; }
|
|||||||
min-width: 96px;
|
min-width: 96px;
|
||||||
}
|
}
|
||||||
.chart-controls .nw-select:focus { outline: 1px solid #4a4f5a; outline-offset: 0; }
|
.chart-controls .nw-select:focus { outline: 1px solid #4a4f5a; outline-offset: 0; }
|
||||||
|
/* 2번째 줄(유형/연도/월) — 연도/월은 내용 크기로(월 줄바뀜 방지), 유형은 기간과 동일 폭. 글씨는 1번째 줄과 동일. */
|
||||||
|
.chart-controls .cc-line-ym { gap: 8px; }
|
||||||
|
.chart-controls .cc-line-ym .nw-select { min-width: 0; }
|
||||||
|
.chart-controls .cc-line-ym .nw-select[data-nw-ymtype] { min-width: 96px; } /* 유형 = 기간 select 와 동일 폭 */
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (max-width: 600px) {
|
||||||
nav.tabs .tab-label { padding: 10px 12px; font-size: 12px; }
|
nav.tabs .tab-label { padding: 10px 12px; font-size: 12px; }
|
||||||
@@ -10028,7 +10035,27 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
'sma20': sa.sma(closes, 20),
|
'sma20': sa.sma(closes, 20),
|
||||||
'sma60': sa.sma(closes, 60),
|
'sma60': sa.sma(closes, 60),
|
||||||
}
|
}
|
||||||
svg = sa.render_svg_chart(snap, range_key='1Y')
|
# 전일종가 — 일봉 캐시에서 오늘 이전 마지막 종가 → 기준선+전일대비 등락률 표시
|
||||||
|
prev_close = None
|
||||||
|
try:
|
||||||
|
import daily_candles_cache as dcc
|
||||||
|
_today = datetime.now(KST).strftime('%Y%m%d')
|
||||||
|
for b in dcc._select_latest(code, 3):
|
||||||
|
if b.get('date') and str(b['date']) < _today and b.get('close'):
|
||||||
|
prev_close = b['close']
|
||||||
|
break
|
||||||
|
except Exception:
|
||||||
|
prev_close = None
|
||||||
|
if not prev_close:
|
||||||
|
# 일봉 캐시 미스 → ka10095(현재가−전일대비)로 전일종가 보강. 모든 종목에 전일대비 % 표시.
|
||||||
|
try:
|
||||||
|
_q = kc.get_watchlist_quotes([code]).get(code) or {}
|
||||||
|
_pc = (_q.get('price') or 0) - (_q.get('change') or 0)
|
||||||
|
if _pc > 0:
|
||||||
|
prev_close = _pc
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
svg = sa.render_svg_chart(snap, range_key='1Y', ref_price=prev_close)
|
||||||
body = svg.encode('utf-8')
|
body = svg.encode('utf-8')
|
||||||
body, enc = _maybe_gzip(body, self.headers.get('Accept-Encoding'))
|
body, enc = _maybe_gzip(body, self.headers.get('Accept-Encoding'))
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
|
|||||||
Reference in New Issue
Block a user