From bb2a06ce6ec28238a1d1bfe6719cf3d565407a74 Mon Sep 17 00:00:00 2001 From: I Luk Kim Date: Mon, 13 Apr 2026 16:48:53 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20reduce=20Alpaca=20multi-bar=20batch=5Fsi?= =?UTF-8?q?ze=20200=20=E2=86=92=20100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Community reports 502 above ~100 symbols per request. Official docs have no stated limit but 200 appears to be a ceiling. 100 is a safe conservative default that avoids the 502 edge case with minimal performance impact (500 tickers = 5 batches instead of 3). Co-Authored-By: Claude Sonnet 4.6 --- app/services/alpaca_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/alpaca_client.py b/app/services/alpaca_client.py index c2e3224..3e2e7b1 100644 --- a/app/services/alpaca_client.py +++ b/app/services/alpaca_client.py @@ -215,7 +215,7 @@ class AlpacaClient: start: Optional[str] = None, end: Optional[str] = None, limit: int = 10000, - batch_size: int = 200, + batch_size: int = 100, feed: Optional[str] = None, ) -> Dict[str, List[Dict]]: """ @@ -231,7 +231,7 @@ class AlpacaClient: start: RFC-3339 date/datetime string end: RFC-3339 date/datetime string limit: Max bars per page (Alpaca max 10000) - batch_size: Max symbols per Alpaca request (default 200, ~1KB URL) + batch_size: Max symbols per Alpaca request (default 100, conservative safe limit) Returns: Dict mapping normalized Alpaca symbol → list of bar dicts