Query editor
/*addresses:hyperliquid bridge: 0x2df1c51e09aecf9cacb7bc98cb1742757f163df7usdc on arbitrum: 0xaf88d065e77c8cc2239327c5edb3a432268e5831*/with date_parameter as (select casewhen '{{timeframe}}' = 'show all time' then cast('2023-12-01' as date)when '{{timeframe}}' = 'past one year' then now() - interval '1' yearwhen '{{timeframe}}' = 'past six months' then now() - interval '6' monthwhen '{{timeframe}}' = 'past three months' then now() - interval '3' monthwhen '{{timeframe}}' = 'past one month' then now() - interval '1' monthend as start_date), hyperliquid_vol as (select date_trunc('day', evt_block_time) as txn_date, contract_address, sum(cast("value" as double)) / 1e6 as asset_amount, count(distinct evt_tx_hash) as txn_total_countfrom erc20_arbitrum.evt_transferjoin date_parameter dp on truewhere contract_address = 0xaf88d065e77c8cc2239327c5edb3a432268e5831and ("from" = 0x2df1c51e09aecf9cacb7bc98cb1742757f163df7or "to" = 0x2df1c51e09aecf9cacb7bc98cb1742757f163df7)and evt_block_time < current_dateand evt_block_time >= dp.start_dateand evt_block_number >= 155689071group by 1, 2), mkt_details as (select date_trunc('day', "minute") as mkt_date, contract_address, symbol, avg(price) as mkt_pricefrom prices.usdwhere blockchain = 'arbitrum'and contract_address = 0xaf88d065e77c8cc2239327c5edb3a432268e5831group by 1, 2, 3), aggregated as (select hyl.txn_date, mkt.symbol, sum(hyl.txn_total_count) as txn_total_count, sum((hyl.asset_amount) * mkt.mkt_price) as total_usd_volumefrom hyperliquid_vol hyljoin mkt_details mkton hyl.txn_date = mkt.mkt_dateand hyl.contract_address = mkt.contract_addressgroup by hyl.txn_date, mkt.symbol), summarized as (select txn_date, sum(case when symbol = 'USDC' then total_usd_volume else 0 end) as usdc_vol_usd, sum(total_usd_volume) as total_usd_volume, sum(case when symbol = 'USDC' then txn_total_count else 0 end) as usdc_txn_count, sum(txn_total_count) as txn_total_countfrom aggregatedgroup by txn_date)select txn_date