feat: add rate limiting for overseas market scanning (issue #51)
Some checks failed
CI / test (pull_request) Has been cancelled
Some checks failed
CI / test (pull_request) Has been cancelled
Add 200ms delay between overseas API calls to prevent hitting KIS API rate limit (EGW00201: 초당 거래건수 초과). Changes: - src/analysis/scanner.py:79-81 - Add asyncio.sleep(0.2) for overseas calls Impact: - EGW00201 errors eliminated during market scanning - Scan completion time increases by ~1.2s for 6 stocks - Trade-off: Slower scans vs complete market data Before: Multiple EGW00201 errors, incomplete scans After: Clean scans, all stocks processed successfully Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,10 @@ class MarketScanner:
|
||||
if market.is_domestic:
|
||||
orderbook = await self.broker.get_orderbook(stock_code)
|
||||
else:
|
||||
# Rate limiting: Add 200ms delay for overseas API calls
|
||||
# to prevent hitting KIS API rate limit (EGW00201)
|
||||
await asyncio.sleep(0.2)
|
||||
|
||||
# For overseas, we need to adapt the price data structure
|
||||
price_data = await self.overseas_broker.get_overseas_price(
|
||||
market.exchange_code, stock_code
|
||||
|
||||
Reference in New Issue
Block a user