Query editor
SELECT*,SUM(Average_Borrow_APY_variable/365) OVER (ORDER BY day) AS cum_borrow,SUM(Average_Supply_APY/365) OVER (ORDER BY day) AS cum_returnFROM (SELECTdate_trunc('{{Time interval}}', evt_block_time) as day,symbol,AVG(stableBorrowRate/1e27) AS Average_Borrow_APY_stable,AVG(variableBorrowRate/1e27) AS Average_Borrow_APY_variable,AVG(liquidityRate/1e27) AS Average_Supply_APY,AVG(stableBorrowRate/1e25) AS Average_Borrow_APY_stable_pct,AVG(variableBorrowRate/1e25) AS Average_Borrow_APY_variable_pct,AVG(liquidityRate/1e25) AS Average_Supply_APY_pct,AVG(variableBorrowRate/1e27)/AVG(liquidityRate/1e27) AS Borrow_Supply_ratio,AVG(variableBorrowRate/1e27)/AVG(liquidityRate/1e27)*100 AS Borrow_Supply_ratio_pctFROM aave_v3_ethereum.Pool_evt_ReserveDataUpdated depositsLEFT JOIN tokens.erc20 t ON deposits.reserve = t.contract_address and blockchain = 'ethereum'WHERE evt_block_time > now() - interval '{{Trading Num Days}}' DAYAND symbol = '{{Symbol}}'GROUP BY 1, 2)mainORDER BY 1 DESC