adriaparcerisasFlow NFT Wallet Behavior Comparison
    Updated 2022-07-16
    -- defining whales those users who move more than 50k in a day

    WITH
    flow_price as (
    SELECT
    trunc(timestamp,'day') as date,
    avg(PRICE_USD) as flow_price
    from flow.core.fact_prices
    where SYMBOL = 'FLOW' and timestamp>=current_date - INTERVAL '2 MONTHS'
    GROUP BY 1
    ),
    sol_price as (
    select
    trunc(block_timestamp,'day') as date,
    avg(swap_to_amount) / avg(swap_from_amount) as sol_price
    from solana.fact_swaps
    where swap_from_mint = 'So11111111111111111111111111111111111111112'
    and swap_to_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
    and swap_to_amount > 0
    and swap_from_amount > 0
    and block_timestamp >= current_date - INTERVAL '2 MONTHS'
    group by 1
    ),
    flow_whales as (
    select
    trunc(block_timestamp,'day') as date,
    buyer as wallet,
    sum(case when CURRENCY = 'A.1654653399040a61.FlowToken' then price*flow_price else price end) as volume_moved
    from flow.core.fact_nft_sales x
    join flow_price y on trunc(x.block_timestamp,'day') = y.date
    where block_timestamp >= current_date - INTERVAL '2 MONTHS'
    group by 1,2
    ),
    final_flow as (
    SELECT
    date,
    Run a query to Download Data