nitsSandBox Top 10 Loss Making Addresses
    Updated 2023-05-21
    with buyer as
    (SELECT buyer_address,tokenid as id , block_timestamp as purchase_time, price_usd as buy_price
    from
    ethereum.core.ez_nft_sales
    where (nft_address ilike '0x5cc5b05a8a13e3fbdb0bb9fccd98d38e50f90c38' )),
    seller as
    (SELECT seller_address,tokenid , block_timestamp as sale_time , price_usd as sale_price
    from
    ethereum.core.ez_nft_sales
    where (nft_address ilike '0x5cc5b05a8a13e3fbdb0bb9fccd98d38e50f90c38' ))
    SELECT buyer_address, net_profit from
    (SELECT *, buy_price- sale_price as net_profit from buyer
    inner join seller
    on seller_address = buyer_address and tokenid = id and purchase_time < sale_time)
    where date(sale_time) >= CURRENT_DATE - {{n}} and net_profit is not NULL
    order by net_profit desc
    LIMIT 10
    Run a query to Download Data