rmasFlow - Wallet Providers - Daily Active Swappers
    Updated 2022-07-11
    WITH

    dim_account AS (
    SELECT
    event_data['address']::varchar AS account_address
    , tx.payer AS account_creation_fee_payer
    , tx.tx_id AS account_creation_tx_id
    , tx.block_timestamp AS account_creation_timestamp
    FROM flow.core.fact_events AS ac
    INNER JOIN flow.core.fact_transactions AS tx
    ON tx.tx_id = ac.tx_id

    WHERE ac.event_type = 'AccountCreated'
    QUALIFY row_number() OVER (partition by account_address order by account_creation_timestamp) = 1
    ),


    daily_swappers AS (
    SELECT
    s.block_timestamp::date AS utc_date
    , da.account_creation_fee_payer
    , count(*) AS swaps

    FROM flow.core.fact_swaps AS s
    LEFT JOIN dim_account AS da
    ON da.account_address = s.trader

    GROUP BY 1,2
    ),


    daily_nft_buyers AS (
    SELECT
    s.block_timestamp::date AS utc_date
    , da.account_creation_fee_payer
    Run a query to Download Data