Query editor
WITH current_data AS (SELECTSUM(delegated_eth) as total_eth_tvl,SUM(delegated_eigen) as total_eigen_tvl,SUM(rewards_for_eth) as total_eth_rewards_in_eigen,SUM(rewards_for_eigen) as total_eigen_rewardsFROM query_4127229),eigen_price AS (SELECTsymbol,minute,price as eigen_price_usdFROM prices.usd_latestwhere blockchain = 'ethereum'and contract_address = 0xec53bF9167f50cDEB3Ae105f56099aaaB9061F83),eth_price as (SELECTsymbol,minute,price as eth_price_usdFROM prices.usd_latestWHEREcontract_address IS NULL AND symbol = 'ETH'),apr_calculation AS (SELECTtotal_eth_tvl,total_eigen_tvl,total_eth_rewards_in_eigen,total_eigen_rewards,eth_price_usd,eigen_price_usd,-- ETH staking APR (EIGEN rewards relative to staked ETH value)(total_eth_rewards_in_eigen * eigen_price_usd) / NULLIF((total_eth_tvl * eth_price_usd), 0) * 52 * 100 as eth_staking_apr,-- EIGEN staking APR(total_eigen_rewards / NULLIF(total_eigen_tvl, 0)) * 52 * 100 as eigen_staking_aprFROM current_data, eigen_price, eth_price)SELECTtotal_eth_tvl,total_eigen_tvl,eigen_price_usd,eth_price_usd,eth_staking_apr,eigen_staking_apr,eth_price_usd / eigen_price_usd as eth_eigen_price_ratioFROM apr_calculation