diff --git a/app/ai/evening.py b/app/ai/evening.py index 96e55ba..80f669a 100644 --- a/app/ai/evening.py +++ b/app/ai/evening.py @@ -104,7 +104,8 @@ def calc_live_ready(summaries: list[dict]) -> dict: win_trades = sum(s["win_trades"] for s in summaries) win_rate = win_trades / total_trades * 100 if total_trades else 0 - # MDD: 누적 손익 기준 최대 낙폭 + # MDD: 초기자본 대비 누적 낙폭 (%) + STARTING_CAPITAL = 10_000_000 cum = 0.0 peak = 0.0 mdd = 0.0 @@ -112,7 +113,7 @@ def calc_live_ready(summaries: list[dict]) -> dict: cum += s["net_pnl"] or 0 if cum > peak: peak = cum - drawdown = (peak - cum) / max(abs(peak), 1) * 100 + drawdown = (peak - cum) / STARTING_CAPITAL * 100 if drawdown > mdd: mdd = drawdown diff --git a/app/execution/kis_client.py b/app/execution/kis_client.py index a1a9e39..f30b8e5 100644 --- a/app/execution/kis_client.py +++ b/app/execution/kis_client.py @@ -181,7 +181,8 @@ class KISClient: await asyncio.sleep(wait) self._req_times.append(time.monotonic()) - async with aiohttp.ClientSession() as session: + _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()