shreyash-5873Terraswap Trader Activity
    Updated 2021-07-14
    with pair_contracts as (select
    *
    from terra.labels
    where address_name like '%Terraswap%Pair'),
    oracle_prices as (select
    date(block_timestamp) as block_date,
    currency,
    symbol,
    avg(price_usd) as daily_price_usd
    from terra.oracle_prices
    group by 1, 2, 3
    )
    select
    --date(m.block_timestamp) as block_date,
    msg_value:sender::string as trader,
    count(*) as total_trades
    --sum((m.msg_value:coins[0]:amount / POW(10, 6)) * op.daily_price_usd) as total_pool_volume_usd
    from terra.msgs m
    inner join pair_contracts pc
    on m.msg_value:contract::string = pc.address
    group by 1
    order by 2 desc
    limit 100;
    Run a query to Download Data