Sajjadiii2023-09-14 07:48 AM
    Updated 2023-10-05
    with price_tab AS (
    SELECT timestamp::date AS date , 'FlowToken' AS token , avg(price_usd) AS price
    FROM flow.price.fact_prices
    WHERE token = 'Flow'
    AND timestamp::date >= '2023-01-01'
    GROUP BY 1 , 2
    UNION all
    SELECT recorded_hour::date AS date , 'SloppyStakes' AS token , avg(close) AS price
    FROM flow.price.fact_hourly_prices
    WHERE id ILIKE '%sloppy%' -- 'A.53f389d96fb4ce5e.SloppyStakes'
    AND recorded_hour::date >= '2023-01-01'
    GROUP BY 1 , 2
    UNION all
    SELECT timestamp::date AS date , 'FlowUtilityToken' AS token , avg(price_usd) AS price
    FROM flow.price.fact_prices
    WHERE token = 'Flow'
    AND timestamp::date >= '2023-01-01'
    GROUP BY 1 , 2
    UNION all
    SELECT timestamp::date AS date , 'DapperUtilityCoin' AS token , avg(1) AS price
    FROM flow.price.fact_prices
    WHERE token = 'Flow'
    AND timestamp::date >= '2023-01-01'
    GROUP BY 1 , 2
    UNION all
    SELECT timestamp::date AS date , 'FiatToken' AS token , avg(1) AS price
    FROM flow.price.fact_prices
    WHERE token = 'Flow'
    AND timestamp::date >= '2023-01-01'
    GROUP BY 1 , 2
    ),

    listing_tab AS (
    SELECT
    block_timestamp
    , tx_id
    Run a query to Download Data