kiacryptoUnique whales count on each blockchain
    Updated 2022-07-19
    with price as(
    select date_trunc('day', block_timestamp) as date1, avg(swap_to_amount / swap_from_amount) as sol_price
    from flipside_prod_db.solana.fact_swaps
    where date1 >= '2022-04-20' and date1 <= current_date - 1 and swap_from_amount > 0 and swap_to_amount > 0 and swap_from_mint = 'So11111111111111111111111111111111111111112' and
    swap_to_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' and (swap_to_amount / swap_from_amount) > 30 and (swap_to_amount / swap_from_amount) < 100
    group by 1
    ),
    flow as (
    select date_trunc('day', block_timestamp) as date, buyer as buyer, sum(price) as buy_amount
    from flow.core.fact_nft_sales
    where date >= '2022-04-20' and date <= current_date - 1 and tx_succeeded = true
    group by 1, 2 having buy_amount >= 50000
    ),
    sol as (
    select date_trunc('day', block_timestamp) as date, purchaser as buyer, sum(sales_amount * sol_price) as buy_amount
    from solana.core.fact_nft_sales, price
    where date >= '2022-04-20' and date <= current_date - 1 and succeeded = true and date = date1
    group by 1, 2 having buy_amount >= 50000
    ),
    eth as (
    select date_trunc('day', block_timestamp) as date, buyer_address as buyer, sum(price_usd) as buy_amount
    from ethereum.core.ez_nft_sales
    where date >= '2022-04-20' and date <= current_date - 1
    group by 1, 2 having buy_amount >= 50000
    )

    select count(distinct buyer) as whales_count, 'Flow' as blockchain
    from flow
    union all

    select count(distinct buyer) as whales_count, 'Solana' as blockchain
    from sol

    union all

    Run a query to Download Data