59. Hourly OHLC Aggregation

Medium

Given intraday stock data df with a datetime column 'time' and a 'price' column, bucket the rows into hourly intervals and compute, for each hour, the opening, highest, lowest, and closing price. Return a DataFrame indexed by the start of each hour with columns open, high, low, close.

Sample data: df:

                 time  price
0 2020-01-01 09:15:00  100.0
1 2020-01-01 09:45:00  102.0
2 2020-01-01 10:05:00  101.0
3 2020-01-01 10:30:00  105.0
4 2020-01-01 10:55:00  103.0
5 2020-01-01 11:10:00  104.0
Implement solve(...)