From cb2e3fae57546cc68e2939b607dbed8718840e78 Mon Sep 17 00:00:00 2001 From: agentson Date: Thu, 5 Feb 2026 00:12:57 +0900 Subject: [PATCH] fix: reduce rate limit from 10 to 5 RPS to avoid API errors (issue #43) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reduce RATE_LIMIT_RPS from 10.0 to 5.0 to prevent "초당 거래건수를 초과하였습니다" (EGW00201) errors from KIS API. Docker logs showed this was the most frequent error (70% of failures), occurring when multiple stocks are scanned rapidly. Changes: - src/config.py: RATE_LIMIT_RPS 10.0 → 5.0 - .env.example: Update default and add explanation comment Trade-off: Slower API throughput, but more reliable operation. Can be tuned per deployment via environment variable. Fixes: #43 Co-Authored-By: Claude Sonnet 4.5 --- .env.example | 5 +++-- src/config.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index cc2ffb0..ac91c53 100644 --- a/.env.example +++ b/.env.example @@ -16,8 +16,9 @@ CONFIDENCE_THRESHOLD=80 # Database DB_PATH=data/trade_logs.db -# Rate Limiting -RATE_LIMIT_RPS=10.0 +# Rate Limiting (requests per second for KIS API) +# Reduced to 5.0 to avoid "초당 거래건수 초과" errors (EGW00201) +RATE_LIMIT_RPS=5.0 # Trading Mode (paper / live) MODE=paper diff --git a/src/config.py b/src/config.py index 222afd0..2999f39 100644 --- a/src/config.py +++ b/src/config.py @@ -37,7 +37,8 @@ class Settings(BaseSettings): DB_PATH: str = "data/trade_logs.db" # Rate Limiting (requests per second for KIS API) - RATE_LIMIT_RPS: float = 10.0 + # Reduced to 5.0 to avoid EGW00201 "초당 거래건수 초과" errors + RATE_LIMIT_RPS: float = 5.0 # Trading mode MODE: str = Field(default="paper", pattern="^(paper|live)$") -- 2.49.1