princefarzamSwap to Blur
    Updated 2023-12-21
    With Swaps AS (
    SELECT
    date_trunc('day', BLOCK_TIMESTAMP) :: date as day,
    Count(DISTINCT ORIGIN_FROM_ADDRESS) AS Number_of_Swappers,
    Count(DISTINCT TX_HASH) AS Number_of_Swaps,
    Sum(AMOUNT_OUT) AS Swap_Volume_to_BLUR,
    Sum(AMOUNT_OUT_USD) AS Swap_Volume_to_BLUR_in_USD,
    Avg(Swap_Volume_to_BLUR_in_USD) over (
    Order by
    day
    ) as avg_Swap_Volume_to_BLUR_in_USD
    FROM
    ethereum.defi.ez_dex_swaps
    WHERE
    SYMBOL_OUT = 'BLUR'
    AND day >= '2023-06-01'
    GROUP BY
    day
    ORDER BY
    day ASC
    ),
    BLUR_Price AS (
    SELECT
    date_trunc('day', HOUR) :: date as day,
    AVG(PRICE) AS BLUR_Price
    FROM
    ethereum.price.ez_hourly_token_prices
    WHERE
    SYMBOL = 'BLUR'
    GROUP BY
    day
    ORDER BY
    day ASC
    )
    SELECT
    S.day AS date,
    QueryRunArchived: QueryRun has been archived