-
Notifications
You must be signed in to change notification settings - Fork 112
Open
Description
If anyone is using MYSQL rather than SQLite I was able to get the new_closing_highs to work and grab the correct date by using the following command: ( to do the new_closing_lows version swap MAX with MIN )
elif stock_filter == 'new_closing_highs':
# The inner join here allows us to grab the whole row with the proper date for MAX(close)
cursor.execute("""
SELECT * FROM (
SELECT symbol, name, t1.stock_id, t1.close, t1.date
FROM stock_price t1
JOIN stock ON stock.id = t1.stock_id
INNER JOIN
(
SELECT stock_id, MAX(close) as max_close
FROM stock_price
GROUP BY stock_id
) t2
ON t1.stock_id = t2.stock_id AND t1.close = t2.max_close
) AS t
WHERE date = %s;
""", (date.today().isoformat(),))
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels