Query editor
-- DeepBook V3 economics and a fixed cohort of frequent quoting accounts.-- Cohort: >=10 days with OrderPlaced in 21 Feb-21 Apr 2026 (60 complete UTC days).-- Eligibility uses only precut history; no requirement to survive after the cut.-- Each order-flow transaction's gas is counted once, at venue level, not assigned to passive makers.-- Gas excludes failed transactions without events and non-order-flow calls; mixed PTBs retain their full cost.-- 7-day gas/volume is a ratio of sums. Quote hours mean hours with a placement, not continuous quote uptime.WITH fills AS (SELECT block_date day, transaction_digest, event_index,max(cast(amount_usd AS double)) amount_usd,count(*) curated_rowsFROM dex_sui.tradesWHERE block_month >= TIMESTAMP '2026-01-01'AND block_date >= DATE '2026-01-01' AND block_date < current_dateAND project = 'deepbook'GROUP BY 1,2,3), raw_events AS (SELECT date day, transaction_digest, event_index, timestamp_ms, event_type,CASE WHEN event_type LIKE '%::OrderPlaced' THEN 'posted'WHEN event_type LIKE '%::OrderCanceled' THEN 'canceled'ELSE 'filled' END action,lower(coalesce(json_extract_scalar(event_json,'$.balance_manager_id'),json_extract_scalar(event_json,'$.maker_balance_manager_id'))) accountFROM sui.eventsWHERE date >= DATE '2026-01-01' AND date < current_dateAND event_type IN ('0x2c8d603bc51326b8c13cef9dd07031a408a48dddb541963357661df5d3204809::order_info::OrderPlaced','0x2c8d603bc51326b8c13cef9dd07031a408a48dddb541963357661df5d3204809::order::OrderCanceled','0x2c8d603bc51326b8c13cef9dd07031a408a48dddb541963357661df5d3204809::order_info::OrderFilled')), joined_events AS (SELECT e.*, f.amount_usd, f.curated_rows,t.transaction_digest matched_transaction, t.execution_success, t.is_system_txn,cast(t.computation_cost AS double)/1e9 computation_sui,cast(t.total_gas_cost AS double)/1e9 net_gas_sui,t.gas_price, t.is_sponsored_tx,row_number() OVER(PARTITION BY e.day,e.transaction_digest ORDER BY e.event_index) transaction_event_numberFROM raw_events eLEFT JOIN fills f ON f.day=e.day AND f.transaction_digest=e.transaction_digest AND f.event_index=e.event_index AND e.action='filled'LEFT JOIN sui.transactions t ON t.date=e.day AND t.transaction_digest=e.transaction_digestAND t.date >= DATE '2026-01-01' AND t.date < current_date), account_days AS (SELECT day,account,count(*) event_count,count_if(action='posted') orders_posted,count_if(action='canceled') orders_canceled,count_if(action='filled') maker_fill_events,count_if(action='filled' AND amount_usd IS NOT NULL) priced_maker_fill_events,sum(CASE WHEN action='filled' THEN amount_usd ELSE 0 END) maker_filled_usd,count(DISTINCT CASE WHEN action='posted' THEN cast(floor(cast(timestamp_ms AS double)/3600000) AS bigint) END) quoting_hours,count_if(transaction_event_number=1) order_flow_transactions,count_if(transaction_event_number=1 AND execution_success AND NOT is_system_txn) successful_order_flow_transactions,count_if(transaction_event_number=1 AND matched_transaction IS NULL) transactions_missing_gas,count_if(transaction_event_number=1 AND is_sponsored_tx) sponsored_transactions,sum(CASE WHEN transaction_event_number=1 AND execution_success AND NOT is_system_txn THEN computation_sui ELSE 0 END) computation_sui,sum(CASE WHEN transaction_event_number=1 AND execution_success AND NOT is_system_txn THEN net_gas_sui ELSE 0 END) net_gas_sui,count_if(transaction_event_number=1 AND execution_success AND NOT is_system_txn AND gas_price=100) floor_priced_transactions,count_if(curated_rows>1) fills_with_duplicate_curated_rowsFROM joined_events GROUP BY 1,2), eligibility AS (SELECT *,count_if(day>=DATE '2026-02-21' AND day<DATE '2026-04-22' AND orders_posted>0) OVER(PARTITION BY account) baseline_quoting_days,row_number() OVER(PARTITION BY account ORDER BY day) account_day_number