fix: Update SQL queries to handle trade_date column consistently
This commit is contained in:
parent
bf6c5e0880
commit
69c5b12fd3
@ -87,7 +87,7 @@ def run_atr_ema_scanner(min_price: float, max_price: float, min_volume: int, por
|
|||||||
daily_data AS (
|
daily_data AS (
|
||||||
SELECT
|
SELECT
|
||||||
ticker,
|
ticker,
|
||||||
toDate(trade_date) as trade_date,
|
toDate(trade_date) as date,
|
||||||
argMax(close, window_start) as daily_close,
|
argMax(close, window_start) as daily_close,
|
||||||
sum(volume) as daily_volume
|
sum(volume) as daily_volume
|
||||||
FROM filtered_data
|
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 (
|
latest_data AS (
|
||||||
SELECT
|
SELECT
|
||||||
ticker,
|
ticker,
|
||||||
argMax(daily_close, trade_date) as last_close,
|
argMax(daily_close, date) as last_close,
|
||||||
sum(daily_volume) as total_volume,
|
sum(daily_volume) as total_volume,
|
||||||
max(toUnixTimestamp(trade_date)) as last_update
|
max(toUnixTimestamp(date)) as last_update
|
||||||
FROM daily_data
|
FROM daily_data
|
||||||
GROUP BY ticker
|
GROUP BY ticker
|
||||||
)
|
)
|
||||||
|
|||||||
@ -96,7 +96,7 @@ def run_atr_ema_scanner_v2(min_price: float, max_price: float, min_volume: int,
|
|||||||
daily_data AS (
|
daily_data AS (
|
||||||
SELECT
|
SELECT
|
||||||
ticker,
|
ticker,
|
||||||
toDate(trade_date) as trade_date,
|
toDate(trade_date) as date,
|
||||||
argMax(close, window_start) as daily_close,
|
argMax(close, window_start) as daily_close,
|
||||||
sum(volume) as daily_volume
|
sum(volume) as daily_volume
|
||||||
FROM filtered_data
|
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 (
|
latest_data AS (
|
||||||
SELECT
|
SELECT
|
||||||
ticker,
|
ticker,
|
||||||
argMax(daily_close, trade_date) as last_close,
|
argMax(daily_close, date) as last_close,
|
||||||
sum(daily_volume) as total_volume,
|
sum(daily_volume) as total_volume,
|
||||||
max(toUnixTimestamp(trade_date)) as last_update
|
max(toUnixTimestamp(date)) as last_update
|
||||||
FROM daily_data
|
FROM daily_data
|
||||||
GROUP BY ticker
|
GROUP BY ticker
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user