fix: 분봉 툴팁 등락률을 당일시가대비 → 전일대비로 (현재 등락율과 일치)
당일시가대비(vs 오늘 시가)는 갭하락 때 현재 등락율과 어긋남(예: 삼성전자 시가대비 -4.1% vs 전일대비 -7%대). 관리자 요청대로 그 봉 종가 vs 전일종가 기준으로 변경 → 마지막 봉이 현재 등락율(-7%대)과 일치. - meta.dayOpen 제거, meta.prevClose(=ref_price) 주입 - _setOhlcText: '당일시가대비' → '전일대비' 라인 - day_open 캡처/파라미터 제거(불필요) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -546,7 +546,7 @@ VOL_BOT = VOL_TOP + VOL_PANEL_H
|
||||
CHART_RANGE_DAYS = {'1Y': 250, '6M': 120, '1M': 21}
|
||||
|
||||
|
||||
def render_svg_chart(snap: dict, range_key: str = '1Y', ref_price: float | None = None, intraday: bool = False, day_open: float | None = None) -> str:
|
||||
def render_svg_chart(snap: dict, range_key: str = '1Y', ref_price: float | None = None, intraday: bool = False) -> str:
|
||||
"""캔들 + SMA 3선 + 거래량 막대 인라인 SVG.
|
||||
|
||||
range_key: '1Y' (250일) | '6M' (120일) | '1M' (21일). 같은 snapshot 데이터에서 슬라이스만.
|
||||
@@ -611,9 +611,8 @@ def render_svg_chart(snap: dict, range_key: str = '1Y', ref_price: float | None
|
||||
],
|
||||
'ymin': y_min,
|
||||
'ymax': y_max,
|
||||
# 분봉일 때만 당일 시가 — 크로스헤어 툴팁의 '당일시가 대비 등락률'용.
|
||||
# day_open(슬라이스 전 오늘 첫 봉 시가)을 caller가 넘기면 그걸 baseline으로 (구간 슬라이스 영향 X).
|
||||
'dayOpen': (int(day_open) if (intraday and day_open) else 0),
|
||||
# 분봉일 때만 전일종가(ref_price) — 크로스헤어 툴팁의 '전일대비 등락률'용 (현재 등락율과 일치).
|
||||
'prevClose': (int(ref_price) if (intraday and ref_price) else 0),
|
||||
'priceTop': PRICE_TOP,
|
||||
'priceBot': PRICE_BOT,
|
||||
'volTop': VOL_TOP,
|
||||
|
||||
Reference in New Issue
Block a user