Query editor
SELECTmonth,SUM(vol_usd) as sumFROM (SELECTmonth,usd_a as vol_usd -- just use A side to save time (will miss out lines where prices only available for token b)--LEAST(COALESCE(usd_a, usd_b), COALESCE(usd_b, usd_a)) as vol_usdFROM (SELECTdate_trunc('month', time) as month,cast(amt_a as double) / power(10, p1.decimals) * p1.price * fee / 10000 as usd_a--amt_b / 10 ^ p2.decimals * p2.price as usd_bFROM (SELECTevt_block_time as time,"signerToken" as tkn_a,"senderToken" as tkn_b,"signerAmount" as amt_a,"senderAmount" as amt_b,cast("protocolFee" as double) as fee,'ethereum' as networkfrom airswap_ethereum."Swap_v3_evt_Swap" swapv3UNIONSELECTevt_block_time as time,-- CASE-- WHEN COALESCE("senderWallet", '\x74de5d4fcbf63e00296fd95d33236b9794016631') = '\x74de5d4fcbf63e00296fd95d33236b9794016631' THEN 'Metamask'-- ELSE 'Web App'--END as source,"signerToken" as tkn_a,"senderToken" as tkn_b,"signerAmount" as amt_a,"senderAmount" as amt_b,cast("signerFee" as double) as fee,'ethereum' as networkfrom airswap_ethereum."Light_evt_Swap" lightUNION ALLSELECTevt_block_time as time,-- CASE-- WHEN COALESCE(senderWallet, '\x74de5d4fcbf63e00296fd95d33236b9794016631') = '\x74de5d4fcbf63e00296fd95d33236b9794016631' THEN 'Metamask'-- ELSE 'Web App'--END as source,signerToken as tkn_a,senderToken as tkn_b,signerAmount as amt_a,senderAmount as amt_b,30 as fee,'ethereum' as networkfrom airswap_ethereum.Light_v0_evt_Swap light --Early version of LightUNION ALL