From 595a659fe76439b79eb11a32fe8ed34dcb15bbc5 Mon Sep 17 00:00:00 2001 From: Bill Date: Thu, 30 Oct 2025 21:15:59 -0400 Subject: [PATCH] fix: reduce log flooding during data fetch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace verbose JSON logging with concise status messages: - Success: '✓ Fetched SYMBOL' - Error: '⚠️ SYMBOL: API rate limit or error - [message]' Prevents logs from being flooded with full JSON responses for 100+ stock symbols during startup. --- data/get_daily_price.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/get_daily_price.py b/data/get_daily_price.py index 6b57faa..909a921 100644 --- a/data/get_daily_price.py +++ b/data/get_daily_price.py @@ -26,10 +26,10 @@ def get_daily_price(SYMBOL: str): url = f'https://www.alphavantage.co/query?function={FUNCTION}&symbol={SYMBOL}&outputsize={OUTPUTSIZE}&apikey={APIKEY}' r = requests.get(url) data = r.json() - print(data) if data.get('Note') is not None or data.get('Information') is not None: - print(f"Error") + print(f"⚠️ {SYMBOL}: API rate limit or error - {data.get('Note') or data.get('Information')}") return + print(f"✓ Fetched {SYMBOL}") with open(f'./daily_prices_{SYMBOL}.json', 'w', encoding='utf-8') as f: json.dump(data, f, ensure_ascii=False, indent=4) if SYMBOL == "QQQ":