omer93matic staked
    Updated 2022-09-21
    with
    matic_staked as (
    SELECT
    trunc(block_timestamp,'day') as date,
    sum(amount) AS matic_staked,
    sum(matic_staked) over (order by date) as total_matic_staked
    FROM polygon.core.dim_labels x
    JOIN polygon.core.ez_matic_transfers y ON x.address = y.matic_to_address
    WHERE date >= '2022-07-01' and address_name LIKE '%stak%' and label_subtype = 'pool'
    GROUP by 1 order by date
    ),
    matic_circulation as (
    SELECT
    trunc(block_timestamp,'day') as date,
    sum(amount) AS matic_circulation
    FROM polygon.core.dim_labels x
    JOIN polygon.core.ez_matic_transfers y ON x.address = y.matic_to_address
    WHERE date >= '2022-07-01' and address_name not LIKE '%stak%' and x.label_type = 'dex'
    GROUP by 1 order by date
    )
    select x.date,
    matic_staked,
    matic_circulation,
    matic_staked/matic_circulation as staking_ratio
    from matic_staked x join matic_circulation y on x.date=y.date
    order by x.date asc
    Run a query to Download Data