[2026-05-22] 일일 리포트 — 14건 승7패7 -127,406원 / TimeoutError 로그 버그 수정
- reports/daily/2026-05-22.md 생성 - main.py: except 블록에 type(e).__name__ 추가 (빈 에러 메시지 방지) - kis_client._request: asyncio.TimeoutError 명시적 catch → RuntimeError re-raise
This commit is contained in:
@@ -182,13 +182,16 @@ class KISClient:
|
||||
self._req_times.append(time.monotonic())
|
||||
|
||||
_timeout = aiohttp.ClientTimeout(total=10)
|
||||
async with aiohttp.ClientSession(timeout=_timeout) as session:
|
||||
if method == "GET":
|
||||
async with session.get(url, headers=headers, params=params) as r:
|
||||
data = await r.json()
|
||||
else:
|
||||
async with session.post(url, headers=headers, json=body) as r:
|
||||
data = await r.json()
|
||||
try:
|
||||
async with aiohttp.ClientSession(timeout=_timeout) as session:
|
||||
if method == "GET":
|
||||
async with session.get(url, headers=headers, params=params) as r:
|
||||
data = await r.json()
|
||||
else:
|
||||
async with session.post(url, headers=headers, json=body) as r:
|
||||
data = await r.json()
|
||||
except asyncio.TimeoutError:
|
||||
raise RuntimeError(f"KIS API 타임아웃 [{tr_id}]")
|
||||
|
||||
# 응답 코드 체크
|
||||
rt_cd = data.get("rt_cd", "")
|
||||
|
||||
+2
-2
@@ -447,7 +447,7 @@ class StockBot:
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"진입 체크 오류 {ticker}: {e}")
|
||||
logger.error(f"진입 체크 오류 {ticker}: {type(e).__name__}: {e}")
|
||||
|
||||
# ─────────────────────────────────────────
|
||||
# 청산 체크
|
||||
@@ -487,7 +487,7 @@ class StockBot:
|
||||
await asyncio.sleep(1.1)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"청산 체크 오류 {ticker}: {e}")
|
||||
logger.error(f"청산 체크 오류 {ticker}: {type(e).__name__}: {e}")
|
||||
|
||||
async def _do_exit(self, ticker: str, pos: dict,
|
||||
current: float, qty: int, reason: str):
|
||||
|
||||
Reference in New Issue
Block a user