feat: 일일 거래 모드 + 요구사항 문서화 체계 (issue #57) #58

Merged
jihoson merged 1 commits from feature/issue-57-daily-trading-mode into main 2026-02-05 09:49:26 +09:00
Collaborator

Summary

Gemini Free tier API 한도(20 calls/day)를 고려한 배치 결정 및 일일 거래 모드 구현.

Closes #57

Changes

1. 배치 결정 시스템 (src/brain/gemini_client.py)

  • decide_batch() 메서드 추가 — 여러 종목을 1회 API 호출로 분석
  • 압축된 JSON 형식으로 프롬프트 최적화
  • 배치 응답 파싱 및 에러 처리 구현

2. 일일 거래 모드 (src/main.py)

  • run_daily_session() 함수 추가
  • 하루 N회 거래 세션 (기본: 4회, 6시간 간격)
  • 시장별 배치 결정 요청 (1 API call per market)
  • realtime 모드와 병행 지원

3. 설정 (src/config.py)

  • TRADE_MODE: daily (배치) | realtime (실시간)
  • DAILY_SESSIONS: 1-10 (기본: 4)
  • SESSION_INTERVAL_HOURS: 1-24 (기본: 6)

4. 요구사항 로그 시스템

  • docs/requirements-log.md 생성 — 사용자 요구사항 시간순 기록
  • CLAUDE.md에 Requirements Management 섹션 추가

5. 문서화

  • docs/architecture.md: Trading Modes 섹션 추가
  • Daily vs Realtime 모드 비교 및 API 사용량 계산

API Efficiency

시장 수 일일 세션 API 호출/일 Free tier 한도
2 (US+KR) 4 8 calls 20 calls ✓
3 시장 4 12 calls 20 calls ✓

Testing

  • 9개의 배치 결정 테스트 추가 (모두 통과)
  • 기존 테스트 유지 (298 passed)
  • 커버리지: 77% (main.py 일부 미커버된 부분 제외)

Test Plan

# 테스트 실행
pytest tests/test_brain.py -v

# Daily 모드 시뮬레이션
TRADE_MODE=daily python -m src.main --mode=paper

# Realtime 모드 (기존)
TRADE_MODE=realtime python -m src.main --mode=paper

Breaking Changes

없음. 기본값이 daily 모드이며 realtime 모드도 지원됨.

🤖 Generated with Claude Code

## Summary Gemini Free tier API 한도(20 calls/day)를 고려한 배치 결정 및 일일 거래 모드 구현. Closes #57 ## Changes ### 1. 배치 결정 시스템 (src/brain/gemini_client.py) - `decide_batch()` 메서드 추가 — 여러 종목을 1회 API 호출로 분석 - 압축된 JSON 형식으로 프롬프트 최적화 - 배치 응답 파싱 및 에러 처리 구현 ### 2. 일일 거래 모드 (src/main.py) - `run_daily_session()` 함수 추가 - 하루 N회 거래 세션 (기본: 4회, 6시간 간격) - 시장별 배치 결정 요청 (1 API call per market) - realtime 모드와 병행 지원 ### 3. 설정 (src/config.py) - `TRADE_MODE`: daily (배치) | realtime (실시간) - `DAILY_SESSIONS`: 1-10 (기본: 4) - `SESSION_INTERVAL_HOURS`: 1-24 (기본: 6) ### 4. 요구사항 로그 시스템 - docs/requirements-log.md 생성 — 사용자 요구사항 시간순 기록 - CLAUDE.md에 Requirements Management 섹션 추가 ### 5. 문서화 - docs/architecture.md: Trading Modes 섹션 추가 - Daily vs Realtime 모드 비교 및 API 사용량 계산 ## API Efficiency | 시장 수 | 일일 세션 | API 호출/일 | Free tier 한도 | |--------|---------|------------|----------------| | 2 (US+KR) | 4 | 8 calls | 20 calls ✓ | | 3 시장 | 4 | 12 calls | 20 calls ✓ | ## Testing - ✅ 9개의 배치 결정 테스트 추가 (모두 통과) - ✅ 기존 테스트 유지 (298 passed) - ✅ 커버리지: 77% (main.py 일부 미커버된 부분 제외) ## Test Plan ```bash # 테스트 실행 pytest tests/test_brain.py -v # Daily 모드 시뮬레이션 TRADE_MODE=daily python -m src.main --mode=paper # Realtime 모드 (기존) TRADE_MODE=realtime python -m src.main --mode=paper ``` ## Breaking Changes 없음. 기본값이 daily 모드이며 realtime 모드도 지원됨. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
agentson added 1 commit 2026-02-05 09:46:09 +09:00
feat: implement daily trading mode with batch decisions (issue #57)
Some checks failed
CI / test (pull_request) Has been cancelled
0057de4d12
Add API-efficient daily trading mode for Gemini Free tier compatibility:

## Features

- **Batch Decisions**: GeminiClient.decide_batch() analyzes multiple stocks
  in a single API call using compressed JSON format
- **Daily Trading Mode**: run_daily_session() executes N sessions per day
  at configurable intervals (default: 4 sessions, 6 hours apart)
- **Mode Selection**: TRADE_MODE env var switches between daily (batch)
  and realtime (per-stock) modes
- **Requirements Log**: docs/requirements-log.md tracks user feedback
  chronologically for project evolution

## Configuration

- TRADE_MODE: "daily" (default) | "realtime"
- DAILY_SESSIONS: 1-10 (default: 4)
- SESSION_INTERVAL_HOURS: 1-24 (default: 6)

## API Efficiency

- 2 markets × 4 sessions = 8 API calls/day (within Free tier 20 calls)
- 3 markets × 4 sessions = 12 API calls/day (within Free tier 20 calls)

## Testing

- 9 new batch decision tests (all passing)
- All existing tests maintained (298 passed)

## Documentation

- docs/architecture.md: Trading Modes section with daily vs realtime
- CLAUDE.md: Requirements Management section
- docs/requirements-log.md: Initial entries for API efficiency needs

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
jihoson merged commit 8e715c55cd into main 2026-02-05 09:49:26 +09:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jihoson/The-Ouroboros#58