Query editor
with alp_amount AS (-- SELECT acc as total_alp_amountSELECT acc - 654020.499284 as total_alp_amount -- need to find out where cause as total_alp_amount (654020 difference from mint/burn)FROMquery_2364621 -- bscORDER BY day descLIMIT 1), stake as (SELECT SUM(ALPamt) as stake_amtFROMquery_2705356) , unstake AS (SELECT SUM(ALPamt) as unstake_amtFROMquery_2705424) , latest_alp_price AS (SELECTtime,priceFROM-- dune.apollox-finance.dataset_alp_pricedune."apollox-finance".dataset_alp_priceorder by 1 desclimit 1) , latest_apx_price AS (SELECTblock_time,price as apx_priceFROMquery_2831365order by 1 desclimit 1), fee_info AS (SELECT *FROM-- dune."apollox-finance".dataset_fee_infodune."apollox-finance".dataset_fee_info), stake_info AS (SELECTstake_amt-unstake_amt as current_staking_amt,price as alp_price,(stake_amt-unstake_amt) * price as staking_valueFROMstakeJOIN unstake ON 1 = 1JOIN latest_alp_price ON 1 = 1), report_prepared AS (SELECTcurrent_staking_amt,alp_price,staking_value,alpfundingfee,alptradingfee,alplipfee,apx_price,((alpfundingfee + alptradingfee + alplipfee ) / 7 ) / (total_alp_amount * alp_price ) *365 as fee_apr-- ,(28800*2.7*apx_price) / (current_staking_amt * alp_price ) *365 as stake_aprFROM