refactor: CB 게이지 pnl_pct 저장 레이어를 L7 → L6_DAILY로 변경
Some checks failed
CI / test (pull_request) Has been cancelled

portfolio_pnl_pct는 일별 성과 지표이므로 실시간 종목 데이터(L7)보다
일별 P&L 레이어(L6_DAILY)가 더 적합함. (PR #197 코드리뷰 반영)

- main.py: L7_REALTIME + ISO timestamp → L6_DAILY + date(YYYY-MM-DD)
- app.py: contexts 쿼리 layer/timeframe 조건 동기화
- tests: _seed_cb_context L6_DAILY + today 날짜로 수정

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
agentson
2026-02-22 00:33:21 +09:00
parent 342511a6ed
commit f3491e94e4
3 changed files with 13 additions and 9 deletions

View File

@@ -355,18 +355,20 @@ def test_positions_empty_when_no_trades(tmp_path: Path) -> None:
def _seed_cb_context(conn: sqlite3.Connection, pnl_pct: float, market: str = "KR") -> None:
import json as _json
from datetime import UTC, datetime
today = datetime.now(UTC).date().isoformat()
conn.execute(
"""
INSERT OR REPLACE INTO contexts (layer, timeframe, key, value, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?)
""",
(
"L7_REALTIME",
"2026-02-21T10:00:00+00:00",
"L6_DAILY",
today,
f"portfolio_pnl_pct_{market}",
_json.dumps({"pnl_pct": pnl_pct}),
"2026-02-21T10:00:00+00:00",
"2026-02-21T10:00:00+00:00",
f"{today}T10:00:00+00:00",
f"{today}T10:00:00+00:00",
),
)
conn.commit()