GT 총자산 비율 매수·leg 티어 배분과 시뮬/실거래 포지션 사이징을 통합한다.

타점·비중을 gt_model로 일반화하고, amount_krw 시각순 배분·EV/WF·상위 leg 대형 매수를
position_sizing과 시뮬 HTML(고정 ₩/회 비교)에 반영한다.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-31 16:11:49 +09:00
parent 2cb67c42b3
commit 5842cc9fa3
14 changed files with 2073 additions and 182 deletions

View File

@@ -37,7 +37,13 @@ CHART_REPORT_CSS = """
.table-scroll { max-height: 480px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 8px; }
.pass { color: #16a34a; font-weight: 600; }
.fail { color: #dc2626; font-weight: 600; }
.cards-group-title { font-size: 0.82rem; color: #475569; margin: 14px 0 6px; font-weight: 600; }
.summary-cards { margin: 16px 0; }
.summary-cards .cards-row-block { display: block; width: 100%; margin-bottom: 14px; }
.summary-cards .cards-row-block:last-child { margin-bottom: 0; }
.cards-group-title {
font-size: 0.82rem; color: #475569; margin: 0 0 8px; font-weight: 600;
display: block;
}
"""
@@ -116,6 +122,28 @@ def card_html(label: str, value: str) -> str:
return f'<div class="card"><span>{label}</span><b>{value}</b></div>'
def stacked_summary_cards_html(
title: str,
cards_inner: str,
) -> str:
"""
제목 한 줄 + 카드 flex 한 줄을 세로 블록으로 묶습니다.
Args:
title: cards-group-title 텍스트(HTML 허용).
cards_inner: .cards 안에 넣을 card div 문자열.
Returns:
cards-row-block HTML.
"""
return (
'<div class="cards-row-block">'
f'<p class="cards-group-title">{title}</p>'
f'<div class="cards">{cards_inner}</div>'
"</div>"
)
def wrap_chart_report_page(
page_title: str,
heading: str,
@@ -135,7 +163,7 @@ def wrap_chart_report_page(
meta_line: 기간·추세 등.
note_html: 안내 박스.
legend_html: 차트 범례 설명.
cards_html: .cards 내부 HTML.
cards_html: .cards 내부 HTML 또는 .summary-cards 블록 전체.
chart_html: plotly embed.
sections_html: h2·테이블·criteria 등 본문 하단.
@@ -154,7 +182,7 @@ def wrap_chart_report_page(
<p class="meta">{meta_line}</p>
{note_html}
<div class="legend-box">{legend_html}</div>
<div class="cards">{cards_html}</div>
{cards_html if "summary-cards" in cards_html else f'<div class="cards">{cards_html}</div>'}
<div class="chart-wrap">{chart_html}</div>
{sections_html}
</body>