fix: market_data에 unrealized_pnl_pct/holding_days 누락으로 보유 종목 SELL 시나리오 미작동 #259

Closed
opened 2026-02-26 00:17:42 +09:00 by agentson · 0 comments
Collaborator

문제

trading_cycle()의 market_data 딕셔너리에 unrealized_pnl_pct, holding_days가 포함되지 않아 보유 종목의 시나리오 평가가 항상 실패.

증상

로그:

  • Condition requires 'unrealized_pnl_pct' but key missing from market_data
  • Condition requires 'holding_days' but key missing from market_data
  • Decision for NVDA (NASDAQ): HOLD (confidence=0)

NVDA 38주 보유 중이지만 take-profit/stop-loss 시나리오가 아예 평가되지 않음.

원인

src/main.py trading_cycle()에서 market_data를 구성할 때:

  • current_price, price_change_pct, rsi, volume_ratio는 포함
  • open_position 조회 후 계산해야 할 unrealized_pnl_pct, holding_days는 누락

수정

trading_cycle() 내 market_data 구성 시 get_open_position()으로 보유 포지션 조회 후:

  • unrealized_pnl_pct = (current_price - entry_price) / entry_price * 100
  • holding_days = (today - entry_date).days
    를 market_data에 추가
## 문제 trading_cycle()의 market_data 딕셔너리에 unrealized_pnl_pct, holding_days가 포함되지 않아 보유 종목의 시나리오 평가가 항상 실패. ## 증상 로그: - Condition requires 'unrealized_pnl_pct' but key missing from market_data - Condition requires 'holding_days' but key missing from market_data - Decision for NVDA (NASDAQ): HOLD (confidence=0) NVDA 38주 보유 중이지만 take-profit/stop-loss 시나리오가 아예 평가되지 않음. ## 원인 src/main.py trading_cycle()에서 market_data를 구성할 때: - current_price, price_change_pct, rsi, volume_ratio는 포함 - open_position 조회 후 계산해야 할 unrealized_pnl_pct, holding_days는 누락 ## 수정 trading_cycle() 내 market_data 구성 시 get_open_position()으로 보유 포지션 조회 후: - unrealized_pnl_pct = (current_price - entry_price) / entry_price * 100 - holding_days = (today - entry_date).days 를 market_data에 추가
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jihoson/The-Ouroboros#259