KuramaOsmosis Privacy Coins + Politics - Volume on Osmosis
    Updated 2023-01-04

    WITH labels_secret as (SELECT PROJECT_NAME, RAW_METADATA[0]:denom as currency, RAW_METADATA[1]:exponent as decimals FROM osmosis.core.dim_labels
    WHERE PROJECT_NAME = 'SCRT'),

    swaps_from_secret as (
    SELECT to_date(block_timestamp) as date,-- count(distinct trader) as num_traders,
    sum(from_amount/pow(10,6)) as secret_sold FROM osmosis.core.fact_swaps
    where tx_status = 'SUCCEEDED'
    and from_currency in (select distinct currency from labels_secret)
    group by 1),

    swaps_to_secret as (
    SELECT to_date(block_timestamp) as date,-- count(distinct trader) as num_traders,
    sum(to_amount/pow(10,6)) as secret_bought FROM osmosis.core.fact_swaps
    where tx_status = 'SUCCEEDED'
    and to_currency in (select distinct currency from labels_secret)
    group by 1),

    avg_scrt_price as (select to_date(recorded_at) as date, symbol, avg(price) as average_daily_price from osmosis.core.dim_prices
    where symbol = 'SCRT'
    group by 1, 2 )
    select a.date, secret_sold, secret_bought, (secret_bought - secret_sold) as diff, average_daily_price from swaps_from_secret a
    left join swaps_to_secret b
    on a.date = b.date
    left join avg_scrt_price c
    on a.date = c.date

    Run a query to Download Data