Query editor
WITHinflows AS (SELECTCOUNT(DISTINCT sender) AS alltime_unique_users,COUNT(DISTINCT CASE WHEN date = CURRENT_DATE AND is_active = TRUE THEN sender END) AS active_unique_users,COUNT(DISTINCT CASE WHEN is_active = FALSE THEN CONCAT(CAST(sender AS VARCHAR), CAST(receiver AS VARCHAR), CAST(token AS VARCHAR), CAST(start_time AS VARCHAR)) END) AS alltime_total_inflows,SUM(CASE WHEN date = CURRENT_DATE AND is_active = TRUE THEN 1 ELSE 0 END) AS num_active_inflows,SUM(value_streamed_usd) AS total_inflow_volume_usd,SUM(CASE WHEN date = CURRENT_DATE - INTERVAL '1' DAY AND is_active = TRUE THEN flow_rate * 2628000 / POW(10,18) * price ELSE 0 END) AS current_monthly_inflow_rate_usdFROM query_5998512),outflows AS (SELECTSUM(amount_usd) AS total_distributed_volume_usdFROM query_5998522),stakes AS (SELECTCOUNT(DISTINCT staker) AS num_of_stakers,SUM(staked_amount) AS staked_amountFROM query_5999608WHERE staked_amount > 0)SELECTinflows.alltime_unique_users,inflows.active_unique_users,inflows.alltime_total_inflows,inflows.num_active_inflows,inflows.total_inflow_volume_usd,inflows.current_monthly_inflow_rate_usd,outflows.total_distributed_volume_usd,stakes.num_of_stakers,stakes.staked_amount,ROUND(((inflows.total_inflow_volume_usd - outflows.total_distributed_volume_usd)/ NULLIF(inflows.total_inflow_volume_usd, 0)) * 100,2) AS execution_cost_percentageFROM inflowsCROSS JOIN outflowsCROSS JOIN stakes