'add generated column with aggregated over a partion and sort

I am trying to add a calculated column that computes a rolling average of a sorted partition. I can make it work as a query but cannot seem to get the result to become a calculated field.

ALTER TABLE PUBLIC "minutes" 
    ADD COLUMN "green_avg" NUMERIC (10,2) 
    AS GENERATED AVG("price") OVER(PARTITION BY "key"
    ORDER BY "endtime" ROWS BETWEEN 30 PRECEDING AND CURRENT ROW)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source