theericstoneNet Buy vs Sell
    Updated 2022-10-27
    select * from optimism.core.dim_labels where

    with allswaps as (
    select distinct tx_hash
    from optimism.core.fact_event_logs
    where block_timestamp > current_date - 30
    and lower(event_name) like '%swap%'
    ),
    sinks as (
    select * from (
    select symbol, token_address,
    avg(price) as mean_pr,
    abs(mean_pr - 1) as dev_1,
    STDDEV(price) as sd_price
    from optimism.core.fact_hourly_token_prices
    where hour > current_date - 30
    group by 1,2
    order by dev_1 asc
    )
    where (
    (dev_1 < .03 and sd_price < .03)
    OR token_address = '0x4200000000000000000000000000000000000006'
    )
    ),
    totalswaps as (
    select allsw.address,
    allsw.token, dc.symbol,
    count(distinct(tx_hash)) as n_swaps
    from (
    select xf.tx_hash, contract_address as token, from_address as address
    from optimism.core.fact_token_transfers xf
    join allswaps a on a.tx_hash = xf.tx_hash
    where xf.block_timestamp > current_date - 30
    union
    Run a query to Download Data