Query editor
withp1inch as (select price as inch_usd from prices.usd where blockchain='ethereum'and contract_address=0x111111111117dc0aa78b770fa6a738034120c302 and minute >= now()-interval '1' day order by minute desc limit 1),erc as (select contract_address, max(symbol) as symbol, max(decimals) as decimals from tokens.erc20 where blockchain='robinhood' group by 1),fills as (select block_time, tx_hash,bytearray_substring(data,45,20) as maker,bytearray_substring(data,77,20) as taker,bytearray_substring(data,109,20) as token_in, bytearray_substring(data,141,20) as token_out,bytearray_to_uint256(bytearray_substring(data,161,32)) as amount_in,bytearray_to_uint256(bytearray_substring(data,193,32)) as amount_outfrom robinhood.logswhere topic0=0x54bc5c027d15d7aa8ae083f994ab4411d2f223291672ecd3a344f3d92dcaf8b2and contract_address=0x111111338c5091e8440b67b168bae16a668ac0deand block_time >= timestamp '2026-08-25 11:37:00'and block_time < timestamp '2026-09-08 11:37:00')selectf.block_time, f.tx_hash, f.maker, f.taker,case when si.symbol in ('NVDA','TSLA','AAPL','SPY','META','AMZN') or so.symbol in ('NVDA','TSLA','AAPL','SPY','META','AMZN') then 'RWA'when si.symbol='VIRTUAL' or so.symbol='VIRTUAL' then 'DeFi' end as category,'1INCH/'||upper(case when si.symbol='1INCH' then so.symbol else si.symbol end) as pair,case when si.symbol='1INCH' then 'buy_1INCH' else 'sell_1INCH' end as side,si.symbol as token_in, so.symbol as token_out,cast(f.amount_in as double)/power(10,coalesce(si.decimals,18)) as amount_in,cast(f.amount_out as double)/power(10,coalesce(so.decimals,18)) as amount_out,(case when si.symbol='1INCH' then cast(f.amount_in as double)/1e18 else cast(f.amount_out as double)/1e18 end) as inch_amt,(case when si.symbol='1INCH' then cast(f.amount_in as double)/1e18 else cast(f.amount_out as double)/1e18 end)* coalesce((select inch_usd from p1inch),0.08) as usd_via_1inch,(case when si.symbol='1INCH' then cast(f.amount_out as double)/power(10,coalesce(so.decimals,18))else cast(f.amount_in as double)/power(10,coalesce(si.decimals,18)) end) as other_leg_amtfrom fills fleft join erc si on si.contract_address=f.token_inleft join erc so on so.contract_address=f.token_outwhere '1INCH' in (si.symbol, so.symbol)and (si.symbol in ('NVDA','TSLA','AAPL','SPY','META','AMZN','VIRTUAL') or so.symbol in ('NVDA','TSLA','AAPL','SPY','META','AMZN','VIRTUAL'))order by category, f.block_time