adriaparcerisasOsmosis Daily Active User 5
    Updated 2022-10-19
    WITH
    daus as (
    SELECT
    distinct tx_from as users,
    trunc(block_timestamp,'week') as weeks,
    count(distinct trunc(block_timestamp,'day')) as active_days
    from osmosis.core.fact_transactions
    group by 1,2
    having active_days>=4
    ),
    daus_2 as (
    select distinct users from daus
    ),
    /*prices as (
    select trunc(recorded_at,'week') as weeks,
    symbol,
    avg(price) as price
    from osmosis.core.dim_prices
    group by 1,2
    ),*/
    lps as (
    SELECT
    trunc(block_timestamp,'week') as weeks,
    -- action,
    -- currency,
    count(distinct tx_id) as txs,
    count(distinct tx_caller_address) as users
    -- sum(amount/pow(10,decimal)) as volume
    from osmosis.core.fact_staking where tx_caller_address in (select * from daus_2)
    group by 1
    ), /*
    lps_2 as (
    SELECT
    lps.weeks,type,action,sum(lp_actions) as lp_actions,
    sum(volume*price) as volume,avg(volume*price) as avg_volume
    from lps join prices on lps.weeks=prices.weeks and lps.currency=prices.symbol
    Run a query to Download Data