rezarwz2023-07-08 11:57 AM
    Updated 2023-07-08
    with price_tl as (
    select
    date_trunc('day', hour) as date,token_address,
    avg(price) as price
    from
    crosschain.core.fact_hourly_prices
    WHERE
    IS_IMPUTED = 'false'
    and PROVIDER in ('coinmarketcap', 'coingecko')
    group by
    1,2
    ),
    all_tx as (
    SELECT
    'eth' as chain,
    tx_hash,
    block_timestamp::date as date,
    ORIGIN_FROM_ADDRESS as wallet_address,
    case
    when AMOUNT_IN_USD is not null then AMOUNT_IN_USD
    when amount_out_usd is not null and AMOUNT_IN_USD is null then amount_out_usd
    end as amount_usd
    FROM
    ethereum.core.ez_dex_swaps

    WHERE
    ORIGIN_TO_ADDRESS = '0x881d40237659c251811cec9c364ef91dc08d300c'
    and event_name like '%Swap%'
    and BLOCK_NUMBER>=11042542
    UNION all
    SELECT
    'bsc' as chain,
    tx_hash,
    block_timestamp::date as date,
    ORIGIN_FROM_ADDRESS as wallet_address,
    Run a query to Download Data