0xbiuni-volume-breakdown by symbol
    Updated 2023-06-06
    with meme_dim as
    (
    SELECT
    Target_Contract
    ,Target_Symbol
    from
    (
    SELECT
    Target_Contract
    ,Target_Symbol
    ,ETH_Amount/Target_Amount as price_by_eth
    ,ROW_NUMBER()over(PARTITION by Target_Contract order by BLOCK_TIMESTAMP) as num_rank
    from
    (
    SELECT
    BLOCK_TIMESTAMP
    ,case when TOKEN_IN ='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' then TOKEN_OUT else TOKEN_IN end as Target_Contract
    ,case when TOKEN_IN ='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' then SYMBOL_OUT else SYMBOL_IN end as Target_Symbol
    ,case when TOKEN_IN ='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' then AMOUNT_IN else AMOUNT_OUT end as ETH_Amount
    ,case when TOKEN_IN ='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' then AMOUNT_OUT else AMOUNT_IN end as Target_Amount
    from ethereum.core.ez_dex_swaps
    where PLATFORM in ('uniswap-v2','uniswap-v3')
    and (TOKEN_IN ='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' or TOKEN_OUT ='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2')
    and case when TOKEN_IN ='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' then AMOUNT_OUT else AMOUNT_IN end!=0
    ) a
    ) a
    where num_rank=1 and price_by_eth<1E-8
    ),

    token_dim as
    (
    select '0x853d955acef822db058eb8505911ed77f175b99e' as contract_address, 'FRAX' as symbol, 'stable_coin' as token_type union all
    select '0x2bdbF15d055899a767F5459A151bEd15Fb8fD2F6' as contract_address, 'UST' as symbol, 'stable_coin' as token_type union all
    select '0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6' as contract_address, 'USDD' as symbol, 'stable_coin' as token_type union all
    select '0x6b175474e89094c44da98b954eedeac495271d0f' as contract_address, 'DAI' as symbol, 'stable_coin' as token_type union all
    select '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' as contract_address, 'USDC' as symbol, 'stable_coin' as token_type union all
    Run a query to Download Data