scottincryptoStader Matic MaticX USDC Prices
    Updated 2022-10-03
    with matic_price as (
    select
    date_trunc('day', hour) as block_day
    , avg(price) as matic_price
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'MATIC'
    and block_day > '2022-09-25'
    and block_day <= current_date
    group by block_day
    )

    , usdc_price as (
    select
    date_trunc('day', hour) as block_day
    , avg(price) as usdc_price
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'USDC'
    and block_day > '2022-09-25'
    and block_day <= current_date
    group by block_day
    )
    , maticx_exchange as (
    -- select
    -- date_trunc('day', block_timestamp) as block_day
    -- , (sum(event_inputs:amount0In::int) + sum(event_inputs:amount0Out::int)) / 1e18 as matic_amount
    -- , (sum(event_inputs:amount1In::int) + sum(event_inputs:amount1Out::int)) / 1e18 as maticx_amount
    -- , matic_amount / maticx_amount as maticx_exchange_rate
    -- from polygon.core.fact_event_logs
    -- where 1=1
    -- and contract_address = '0xb0e69f24982791dd49e316313fd3a791020b8bf7'
    -- and event_name = 'Swap'
    -- and block_day > '2022-09-25'
    -- and block_day <= current_date
    -- group by block_day
    select
    Run a query to Download Data