Sandeshuser types trading
    Updated 2024-10-10
    -- forked from user types trading @ https://flipsidecrypto.xyz/edit/queries/a7055a50-b477-4b15-9b73-4de49344a237

    with changes as
    (
    with dates as
    (
    select date_trunc('day',BLOCK_TIMESTAMP) as date from ethereum.core.fact_transactions
    where date>='2023-04-06 00:00:00.000'
    and date <= current_date
    group by 1
    ),
    buy_sell_table as
    ((
    select
    date_trunc('day',BLOCK_TIMESTAMP) as date,
    nft_to_address as address ,
    1 as amount
    from ethereum.nft.ez_nft_transfers
    where block_number>='16985982'
    and nft_address=lower('0x1B41d54B3F8de13d58102c50D7431Fd6Aa1a2c48')
    -- and nft_to_address='0x5221251f4494dc0a3a1e25359be0528a858afed9'
    )
    union all
    (
    select
    date_trunc('day',BLOCK_TIMESTAMP) as date,
    nft_from_address as address,
    -1 as amount
    from ethereum.nft.ez_nft_transfers
    where block_number>='16985982'
    and nft_address=lower('0x1B41d54B3F8de13d58102c50D7431Fd6Aa1a2c48')
    -- and nft_from_address='0x5221251f4494dc0a3a1e25359be0528a858afed9'
    )
    QueryRunArchived: QueryRun has been archived