hrst79asset flow main
    Updated 2023-04-30
    (
    with base as(
    select

    block_timestamp ,
    (amount * PRICE) as amount,
    case
    when from_address = lower('0xEf8801eaf234ff82801821FFe2d78D60a0237F97') then 'Outflow'
    when to_address = lower('0xEf8801eaf234ff82801821FFe2d78D60a0237F97') then 'Inlfow'
    end as label

    from ethereum.core.ez_token_transfers a
    join ethereum.core.fact_hourly_token_prices prices

    on date_trunc('hour',a.block_timestamp) = prices.hour
    and prices.symbol = a.symbol


    UNION all



    select
    block_timestamp,
    (amount * PRICE) as amount,
    case
    when eth_from_address = lower('0xCBD6832Ebc203e49E2B771897067fce3c58575ac') then 'Outflow'
    when eth_to_address = lower('0xCBD6832Ebc203e49E2B771897067fce3c58575ac') then 'Inflow'
    end as label
    from ethereum.core.ez_eth_transfers b
    join ethereum.core.fact_hourly_token_prices prices

    on date_trunc('hour',b.block_timestamp) = prices.hour
    where prices.symbol = 'WETH'

    Run a query to Download Data