Query editor
with stats as (select distinctsingle.day,single.current_value_of_investment as "100% ETH",hodl.current_value_of_investment as "HODL",--gyro.current_value_of_investment as "Dynamic ECLP",-- the gyro eclp query only added incentive for eth/usdc base pool 0x867...0907, other pools current_value_of_investment = current_value_of_investment_with_incentives-- commented out because showing this pool 0x867...0907 as a featured pool on the Pool Portfolio Dashboardgyro.current_value_of_investment_with_incentives as "Dynamic ECLP"from "query_5889839(start = '{{start}}',blockchain='{{chain}}',token_a='{{token_a}}')" singleleft join "query_5889017(start='{{start}}', blockchain='{{chain}}', token_a='{{token_a}}', token_b='{{other_token}}')" hodlon hodl.day = single.dayleft join "query_5885191(start='{{start}}', blockchain='{{chain}}', pool = '{{pool address}}')"gyroon gyro.day = single.daywhere single.day <=current_date - interval '1' day),running_max as (selectday,"100% ETH","HODL","Dynamic ECLP",max("100% ETH") over (order by day rows between unbounded preceding and current row) as eth_running_max,max("HODL") over (order by day rows between unbounded preceding and current row) as hodl_running_max,max("Dynamic ECLP") over (order by day rows between unbounded preceding and current row) as eclp_running_maxfrom stats),drawdown as (selectday,"100% ETH","HODL","Dynamic ECLP",case when eth_running_max > 0 then ("100% ETH" - eth_running_max) / eth_running_max * 100else 0end as eth_drawdown_pct,case when hodl_running_max > 0 then ("HODL" - hodl_running_max) / hodl_running_max * 100else 0end as hodl_drawdown_pct,casewhen eclp_running_max > 0 then ("Dynamic ECLP" - eclp_running_max) / eclp_running_max * 100else 0end as eclp_drawdown_pctfrom running_max)select'Max Drawdown Analysis' as metric,min(eth_drawdown_pct) as "100% ETH Max Drawdown (%)",min(hodl_drawdown_pct) as "HODL Max Drawdown (%)",min(eclp_drawdown_pct) as "Dynamic ECLP Max Drawdown (%)"from drawdown