feat: include current holdings in pre-market AI prompt #170

Closed
opened 2026-02-20 08:23:25 +09:00 by agentson · 0 comments
Collaborator

문제

PreMarketPlanner._build_prompt()가 스캐너 후보(candidates)만 AI에게 전달.
현재 보유 중인 종목과 미실현 손익 정보가 없으므로 AI가 SELL/HOLD 전략을
보유 포지션 기준으로 생성하지 못함.

구현

  1. _build_prompt()current_holdings: list[dict] | None 파라미터 추가
  2. 프롬프트에 '## Current Holdings' 섹션 추가 (종목코드, 수량, 매수가, 미실현손익%)
  3. holdings 종목이 candidates에 없어도 stocks JSON에 포함하도록 AI 지시 추가
  4. generate_playbook() 인터페이스에 current_holdings 파라미터 추가
  5. main.py에서 브로커 balance + DB entry_price로 holdings 구성 후 전달

테스트

  • test_build_prompt_includes_holdings_section
  • test_build_prompt_no_holdings_omits_section
  • test_generate_playbook_passes_holdings_to_prompt
## 문제 PreMarketPlanner._build_prompt()가 스캐너 후보(candidates)만 AI에게 전달. 현재 보유 중인 종목과 미실현 손익 정보가 없으므로 AI가 SELL/HOLD 전략을 보유 포지션 기준으로 생성하지 못함. ## 구현 1. `_build_prompt()`에 `current_holdings: list[dict] | None` 파라미터 추가 2. 프롬프트에 '## Current Holdings' 섹션 추가 (종목코드, 수량, 매수가, 미실현손익%) 3. holdings 종목이 candidates에 없어도 stocks JSON에 포함하도록 AI 지시 추가 4. `generate_playbook()` 인터페이스에 `current_holdings` 파라미터 추가 5. main.py에서 브로커 balance + DB entry_price로 holdings 구성 후 전달 ## 테스트 - test_build_prompt_includes_holdings_section - test_build_prompt_no_holdings_omits_section - test_generate_playbook_passes_holdings_to_prompt
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jihoson/The-Ouroboros#170