Query editor
/* !Generated view warning: you can't query views in dune_user_generated anymore. All queries in DuneSQL are by default views though (try querying the table 'query_1747157') */WITHdta AS (selecttokenId as pos_token_id, wallet, amount0, amount1, theorical_tok_0_out, theorical_tok_1_out, output_amount0, output_amount1, (case when theorical_tok_0_out > 0 then output_amount0 / theorical_tok_0_out else output_amount1 / theorical_tok_1_out end - 1) * 100 as percent_more, (output_amount1 - theorical_tok_1_out ) * tok_1_close_price + (output_amount0 - theorical_tok_0_out ) * tok_0_close_price as lp_fees_earned, output_amount0 * tok_0_close_price + output_amount1 * tok_1_close_price as total_usd_value, date_diff('hour', open_date, close_date) as order_lifetime, open_date, close_datefromquery_2632504where close_date is not null)SELECTCOUNT(*) AS limit_orders_number, COUNT(DISTINCT wallet) AS limit_order_users, AVG(order_lifetime) AS average_order_lifetime, AVG(total_usd_value) AS average_usd_value, APPROX_PERCENTILE(total_usd_value, 0.5) AS pct50_order_size, avg(percent_more) as pct_more, SUM(total_usd_value) AS total_volume_closed, avg(lp_fees_earned) AS dollars_earned, APPROX_PERCENTILE(lp_fees_earned,0.5) AS median_fees, MAX(percent_more) AS pct_more_max, MAX(close_date) AS date_freshnessFROMdta