diff --git a/src/screener/t_atr_ema_v2.py b/src/screener/t_atr_ema_v2.py index c0d9e58..13e1202 100644 --- a/src/screener/t_atr_ema_v2.py +++ b/src/screener/t_atr_ema_v2.py @@ -49,8 +49,15 @@ def run_atr_ema_target_scanner(min_price: float, max_price: float, min_volume: i return print("\nšŸ” Verifying data availability...") - with client.query_stream(f"SELECT ticker FROM stock_db.stock_prices WHERE window_start BETWEEN {start_ts} AND {end_ts} GROUP BY ticker HAVING count() > 50") as stream: - valid_symbols = {row[0] for row in stream.result_rows} + valid_query = f""" + SELECT ticker + FROM stock_db.stock_prices + WHERE window_start BETWEEN {start_ts} AND {end_ts} + GROUP BY ticker + HAVING count() > 50 + """ + valid_result = client.query(valid_query) + valid_symbols = {row[0] for row in valid_result.result_rows} qualified_stocks = [s for s in stocks if s[0] in valid_symbols] print(f"\nāœ… Found {len(qualified_stocks)} stocks with sufficient historical data")