mattkstewSSM NFTs 0
    Updated 2023-01-31
    with tab1 as (
    select
    block_timestamp,
    purchaser,
    mint,
    sales_amount as bought_amount

    from solana.core.fact_nft_sales
    )
    ,
    tab2 as (
    select
    block_timestamp,
    Seller,
    mint,
    sales_amount as sold_amount

    from solana.core.fact_nft_sales
    )

    , tab3 as (
    select
    tab1.block_timestamp as date,
    purchaser,
    sold_amount - bought_amount as net_profit

    from tab1 left outer join tab2 on
    purchaser = seller and tab1.mint = tab2.mint
    where bought_amount is not null
    and sold_amount is not null
    )

    select
    date_trunc('week', date),
    sum(net_profit) as Volume_in_trades,
    count_if(net_profit > 0) as "Profitable Trade",
    Run a query to Download Data