I am trying to make one of those stock charts using postgreSQL that will look like the following.
My data would look something like this:
stock_data
stock_price trade_datetime
5.1 | 1/1/2000 1:00 PM
6.2 | 1/1/2000 2:00 PM
5.0 | 1/2/2000 1:00 PM
3.4 | 1/2/2000 2:00 PM
4.8 | 1/2/2000 3:00 PM
7.0 | 1/3/2000 2:30 PM
5.9 | 1/3/2000 5:55 PM
Desired result
MIN | MAX | AVG | close | date
5.1 | 6.2 | 5.65| 6.2 | 1/1/2000
3.4 | 5.0 | 4.4 | 4.8 | 1/2/2000
5.9 | 7.0 | 6.45| 5.9 | 1/3/2000
I am thinking I probably need to use windowed functions, but I just can't seem to get this one right.
