[2026-05-15] rate limit·전일데이터·TR ID 등 버그 수정

- main.py: sleep 0.05/0.1 → 1.1초 (KIS rate limit 준수)
- main.py: 전일 날짜 계산 수정 (월요일→금요일), 인라인 주석 env 파싱, 장 중 재시작 즉시 루프 진입
- strategy/volatility_breakout.py: has_prev_data() 추가, 중복 수집 skip
- db/repository.py, order_executor.py: UPDATE ORDER BY → 서브쿼리 수정 (SQLite 호환)
- kis_client.py: get_balance TR ID VTTC8001R → VTTC8434R
- test_connection.py: API 호출 간 sleep 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-15 13:38:40 +09:00
parent 253867ef1c
commit a64a3f017b
7 changed files with 77 additions and 19 deletions
+1 -1
View File
@@ -286,7 +286,7 @@ class KISClient:
async def get_balance(self) -> Dict:
"""주식 잔고 조회 (보유 종목 + 예수금)"""
tr_id = "VTTC8001R" if self.is_mock else "TTTC8001R"
tr_id = "VTTC8434R" if self.is_mock else "TTTC8434R"
data = await self._request(
method = "GET",
+5 -2
View File
@@ -91,8 +91,11 @@ class OrderExecutor:
conn.execute("""
UPDATE trades
SET exit_time=?, exit_price=?, exit_reason=?, fee=fee+?
WHERE ticker=? AND exit_time IS NULL
ORDER BY id DESC LIMIT 1
WHERE id = (
SELECT id FROM trades
WHERE ticker=? AND exit_time IS NULL
ORDER BY id DESC LIMIT 1
)
""", (
datetime.now().strftime("%H:%M:%S"),
exit_price, reason, fee, ticker,