mrwildcatCopy of Copy of query6_hackaton_netflow
    Updated 2022-12-15
    -- yearly netflow
    -- 362
    select
    sum (
    case
    when to_address = lower('0x65392485b8d869e59b5b2a3cf7de815ed16939aa') then amount_usd
    when from_address = lower('0x65392485b8d869e59b5b2a3cf7de815ed16939aa') then amount_usd * -1
    end ) as netflow
    from
    ethereum.core.ez_token_transfers
    where
    block_timestamp::date >= '2022-01-01'

    -- 3395
    select sum(amount_usd) FROM ethereum.core.ez_token_transfers
    where to_address = lower('0x65392485b8d869e59b5b2a3cf7de815ed16939aa')
    and block_timestamp::date >= '2022-01-01'
    -- 3668
    select sum(amount_usd) FROM ethereum.core.ez_token_transfers
    where origin_from_address = lower('0x65392485b8d869e59b5b2a3cf7de815ed16939aa')
    and block_timestamp::date >= '2022-01-01'


    --

    select
    sum(
    case
    when to_address = lower('0x65392485b8d869e59b5b2a3cf7de815ed16939aa') then amount_usd
    when origin_from_address = lower('0x65392485b8d869e59b5b2a3cf7de815ed16939aa') then amount_usd * -1
    else 0
    end
    ) as netflow
    from
    ethereum.core.ez_token_transfers
    Run a query to Download Data