kimkimNumber of Solend users and SOL price in 2022 by day
    Updated 2022-08-02
    with Table1 as (
    select
    a.BLOCK_TIMESTAMP::date as date,
    count(distinct (signers[0])) as users
    FROM solana.core.fact_events a
    join solana.core.fact_transactions b
    on a.tx_id = b.tx_id
    where a.PROGRAM_ID = 'So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo'
    and a.BLOCK_TIMESTAMP >='2022-01-01'
    group by 1
    ),

    sol_price as (
    select
    date(block_timestamp) as date,
    avg(swap_to_amount) / avg(swap_from_amount) as sol_price
    from solana.fact_swaps
    where swap_from_mint = 'So11111111111111111111111111111111111111112'
    and swap_to_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
    and swap_to_amount > 0
    and swap_from_amount > 0
    and date(block_timestamp) >= '2022-01-01'
    group by 1
    order by 1 asc
    )


    select
    a.date,
    a.users,
    b.sol_price
    from Table1 a
    join sol_price b
    on a.date=b.date

    Run a query to Download Data