Moeaxl Chain Swaps 2
    Updated 2023-04-28
    with raw as (
    select * ,
    case when symbols = 'ETH' then 'WETH' else symbols end as symbol from
    (select *, replace(replace(TOKENs,'axl'),'st') symbols
    from (select *,
    iff (TOKEN_SYMBOL ilike '%.%',split(TOKEN_SYMBOL,'.')[1] ,TOKEN_SYMBOL) TOKENs
    from axelar.core.ez_squid
    ))
    )
    , p_t as (select
    date(HOUR) as days,
    symbol token ,
    avg(PRICE) as price
    from
    ethereum.core.fact_hourly_token_prices
    group by 1,2)


    , base as (
    select
    *,
    AMOUNT*price as amount_usd
    from
    raw
    inner join p_t
    on token = SYMBOL and BLOCK_TIMESTAMP::date = days)

    select
    case
    when amount_usd < 10 then 'under 10 $'
    when amount_usd >= 10 and amount_usd < 100 then '10-100 $'
    when amount_usd >= 100 and amount_usd < 1000 then '100-1000 $'
    when amount_usd >= 1000 and amount_usd < 10000 then '1k-10k $'
    when amount_usd >= 10000 and amount_usd < 100000 then '10k-100k $'
    when amount_usd >= 100000 then 'over 100k $'
    Run a query to Download Data