Rounding function in a windowed range in PostgreSQL 14

Solution 1:

You can use ROUND (source [ , n ] ) as

source is a number or a numeric expression that is to be rounded
n is an integer that determines the number of decimal places after rounding

NOTE : n is optional and if omitted default value is 0.

You must cast the value to be rounded to numeric to use above mentioned version of round.

SELECT quote_date, price, 
round(avg(price::numeric) OVER(ORDER BY quote_date ROWS BETWEEN 8 PRECEDING AND CURRENT ROW), 2) AS nine_day_avg
FROM quote_datas where symbol = 'A' order by quote_date desc