keshanOsmosis stables 4
    Updated 2022-06-28
    with sushi as (select s.block_timestamp::date as date, symbol_in, sum(amount_in_usd) as amount_in --, sum(from_amount) as thor
    from ethereum.sushi.ez_swaps s
    -- left join flipside_prod_db.thorchain.swaps t on symbol_in=split(split(t.pool_name, '.')[1], '-')[0] and s.block_timestamp::date = t.block_timestamp::date
    where symbol_in in ('USDC', 'USDT', 'UST', 'DAI', 'BUSD')
    group by date, symbol_in),
    thor as (select block_timestamp::date as date, split(split(t.pool_name, '.')[1], '-')[0] as symbol_in, sum(from_amount) as amount_in --, sum(from_amount) as thor
    from flipside_prod_db.thorchain.swaps t
    where symbol_in in ('USDC', 'USDT', 'UST', 'DAI', 'BUSD')
    group by date, symbol_in )

    select s.date, s.amount_in as sushi, t.amount_in as thor, case when s.symbol_in is null then t.symbol_in else s.symbol_in end as currency
    from sushi s left join thor t on s.date=t.date and s.symbol_in=t.symbol_in
    Run a query to Download Data