satsihWhere users got their liq users
    Updated 2023-05-25
    with
    benqi_contracts as (
    SELECT
    *
    FROM
    avalanche.core.dim_labels
    WHERE
    project_name ilike '%benqi%'
    ),
    token_prices as (
    with
    qi_prices as (
    SELECT
    hour::date as date,
    symbol as symbol_join_id,
    symbol,
    avg(price) as price_usd
    FROM
    avalanche.core.fact_hourly_token_prices
    GROUP BY
    1,
    2,
    3
    )
    SELECT
    hour::date as date,
    CASE
    WHEN symbol = 'WBTC' THEN 'BTC'
    WHEN symbol = 'WETH' THEN 'ETH'
    WHEN symbol = 'WAVAX' THEN 'AVAX'
    ELSE symbol
    END as symbol_join_id,
    symbol,
    avg(price) as price_usd
    FROM
    ethereum.core.fact_hourly_token_prices
    Run a query to Download Data