Need a query for accumulated values
You can combine a GROUP BY to find the max() value and a window function:

select date_trunc('hour', "time") as "time",
       sum(max(value)) over (order by date_trunc('hour', "time"))
from the_table
group by date_trunc('hour', "time")
order by date_trunc('hour', "time")


This works, because the window function is applied after the GROUP BY. Using an order by in the window definition turns a "regular" sum into a running total.



To round the timestamp to other intervals, see these two questions on Stackoverflow


What is the fastest way to truncate timestamps to 5 minutes in Postgres? 
postgresql date_trunc to arbitrary precision?