Query editor
WITHshares AS (SELECT(preTotalEther * 1e27) / CAST(preTotalShares AS DOUBLE) AS pre_share_rate,(postTotalEther * 1e27) / CAST(postTotalShares AS DOUBLE) AS post_share_rate,*FROMlido_ethereum.steth_evt_TokenRebased),oracle_time AS (SELECTLAG(evt_block_time,1,evt_block_time - INTERVAL '24' hour) OVER (ORDER BYevt_block_time NULLS FIRST) AS time,evt_block_time AS next_time,((postTotalPooledEther - preTotalPooledEther) * 365 * 24 * 60 * 60) / CAST((preTotalPooledEther * timeElapsed) AS DOUBLE) AS staking_APR,(postTotalPooledEther - preTotalPooledEther) AS lido_rewards,preTotalPooledEther,postTotalPooledEther,timeElapsedFROMlido_ethereum.LegacyOracle_evt_PostTotalSharesWHEREevt_block_time >= CAST(CAST(CAST('2022-09-01 12:00' AS TIMESTAMP) AS TIMESTAMP) AS DATE)AND evt_block_time <= CAST(CAST(CAST('2023-05-16 00:00' AS TIMESTAMP) AS TIMESTAMP) AS DATE)UNION ALLSELECTLAG(d.evt_block_time,1,d.evt_block_time - INTERVAL '24' hour) OVER (ORDER BYd.evt_block_time NULLS FIRST) AS time,d.evt_block_time AS next_time,(365 * 24 * 60 * 60 * (s.post_share_rate - s.pre_share_rate)) / CAST((s.pre_share_rate * s.timeElapsed * 0.9) AS DOUBLE),withdrawalsWithdrawn + postCLBalance - preCLBalance + executionLayerRewardsWithdrawn AS lido_rewards,r.preTotalEther,r.postTotalEther,r.timeElapsed