binhachonAverage Age of Synth Holders
    Updated 2022-04-09
    with minting_transaction as (
    select
    date_part(epoch_second, block_timestamp) as epoch_time,
    native_to_address,
    to_asset,
    to_amount
    from thorchain.swaps
    where to_asset like '%/%'
    ),
    burning_transaction as (
    select
    date_part(epoch_second, block_timestamp) as epoch_time,
    from_address,
    from_asset,
    from_amount
    from thorchain.swaps
    where from_asset like '%/%'
    ),
    average_mint_time as (
    select
    native_to_address,
    to_asset,
    sum(to_amount) as mint_amount,
    sum(epoch_time * to_amount) / sum(to_amount) as average_mint_epoch_time
    from minting_transaction
    group by 1, 2
    ),
    average_burn_time as (
    select
    from_address,
    from_asset,
    sum(from_amount) as burn_amount,
    sum(epoch_time * from_amount) / sum(from_amount) as average_burn_epoch_time
    from burning_transaction
    group by 1, 2
    ),
    Run a query to Download Data