NavidCopy of Copy of open
    Updated 2022-09-29
    with buys as (
    select
    date_trunc('month', block_timestamp) as day,
    eth_to_address as to_address,
    sum(amount) as buy_amount
    from
    ethereum.core.ez_eth_transfers
    group by
    day, eth_to_address
    ), sells as (
    select
    date_trunc('month', block_timestamp) as day,
    eth_from_address as from_address,
    sum(amount) as sell_amount
    from
    ethereum.core.ez_eth_transfers
    group by
    day, eth_from_address
    ), asset_change as (
    select
    b.day,
    b.to_address as address,
    iff(buy_amount is null, 0, buy_amount)-iff(sell_amount is null, 0, sell_amount) as eth_amount
    from
    buys b full outer join sells s on b.day=s.day and b.to_address=s.from_address
    ), asset_trend as (
    select
    day,
    address,
    sum(eth_amount) over (partition by address order by day asc) as eth
    from
    asset_change
    ), labled_assets_trend as (
    select
    day,
    address,
    Run a query to Download Data