fix: Update SQL queries to handle trade_date column consistently

This commit is contained in:
Bobby (aider) 2025-02-09 00:35:30 -08:00
parent bf6c5e0880
commit 69c5b12fd3
2 changed files with 6 additions and 6 deletions

View File

@ -87,7 +87,7 @@ def run_atr_ema_scanner(min_price: float, max_price: float, min_volume: int, por
daily_data AS (
SELECT
ticker,
toDate(trade_date) as trade_date,
toDate(trade_date) as date,
argMax(close, window_start) as daily_close,
sum(volume) as daily_volume
FROM filtered_data
@ -98,9 +98,9 @@ def run_atr_ema_scanner(min_price: float, max_price: float, min_volume: int, por
latest_data AS (
SELECT
ticker,
argMax(daily_close, trade_date) as last_close,
argMax(daily_close, date) as last_close,
sum(daily_volume) as total_volume,
max(toUnixTimestamp(trade_date)) as last_update
max(toUnixTimestamp(date)) as last_update
FROM daily_data
GROUP BY ticker
)

View File

@ -96,7 +96,7 @@ def run_atr_ema_scanner_v2(min_price: float, max_price: float, min_volume: int,
daily_data AS (
SELECT
ticker,
toDate(trade_date) as trade_date,
toDate(trade_date) as date,
argMax(close, window_start) as daily_close,
sum(volume) as daily_volume
FROM filtered_data
@ -107,9 +107,9 @@ def run_atr_ema_scanner_v2(min_price: float, max_price: float, min_volume: int,
latest_data AS (
SELECT
ticker,
argMax(daily_close, trade_date) as last_close,
argMax(daily_close, date) as last_close,
sum(daily_volume) as total_volume,
max(toUnixTimestamp(trade_date)) as last_update
max(toUnixTimestamp(date)) as last_update
FROM daily_data
GROUP BY ticker
)