nitsFlipping
    Updated 2022-10-20
    with a as
    (SELECT block_timestamp as bt, nft_collection as nc, nft_id as nid, buyer as b from flow.core.fact_nft_sales ),
    flow as
    ( SELECT count(*) as total_instances, sum(in_a_day) as total_in_a_day, sum(in_a_week) as total_in_a_week,
    total_in_a_week/total_instances*100 as percent_in_a_week,
    total_in_a_day/total_instances*100 as percent_in_a_day,
    sum(in_a_month) as total_in_a_month,
    total_in_a_month/total_instances *100 as percent_in_a_month,
    'flow' as chain
    from
    (SELECT *, case when timestampdiff(sql_tsi_hour, bt, block_timestamp) < 24 then 1 else 0 end as in_a_day,
    case when timestampdiff(sql_tsi_hour, bt, block_timestamp) < 24*7 then 1 else 0 end as in_a_week,
    case when timestampdiff(sql_tsi_hour, bt, block_timestamp) < 24*30 then 1 else 0 end as in_a_month
    from flow.core.fact_nft_sales
    inner join a
    on block_timestamp > bt and nft_collection = nc and nft_id = nid and b= seller) ),
    e as
    (SELECT block_timestamp as bt, nft_address as na, tokenid as tid, buyer_address as b from ethereum.core.ez_nft_sales) ,
    eth as
    (SELECT count(*) as total_instances, sum(in_a_day) as total_in_a_day, sum(in_a_week) as total_in_a_week,
    total_in_a_week/total_instances*100 as percent_in_a_week,
    total_in_a_day/total_instances*100 as percent_in_a_day,
    sum(in_a_month) as total_in_a_month,
    total_in_a_month/total_instances *100 as percent_in_a_month,
    'eth' as chain
    from
    (SELECT *, case when timestampdiff(sql_tsi_hour, bt, block_timestamp) < 24 then 1 else 0 end as in_a_day,
    case when timestampdiff(sql_tsi_hour, bt, block_timestamp) < 24*7 then 1 else 0 end as in_a_week,
    case when timestampdiff(sql_tsi_hour, bt, block_timestamp) < 24*30 then 1 else 0 end as in_a_month from ethereum.core.ez_nft_sales
    inner join e
    on block_timestamp > bt and nft_address = na and tokenid = tid and b = seller_address )),
    s as
    (SELECT block_timestamp as bt, purchaser as b, mint as m from solana.core.fact_nft_sales ) ,
    sol as
    (SELECT count(*) as total_instances, sum(in_a_day) as total_in_a_day, sum(in_a_week) as total_in_a_week,
    total_in_a_week/total_instances*100 as percent_in_a_week,
    Run a query to Download Data