maybeyonasthor_asset_move_in
    Updated 2021-10-23
    with in_thor as(
    select
    block_timestamp,
    from_asset,
    from_amount,
    from_amount_usd,
    'in' as direction
    from thorchain.swaps
    where from_asset != 'THOR.RUNE'
    ),
    out_thor as(
    select
    block_timestamp,
    from_asset,
    to_amount,
    to_amount_usd,
    'out' as direction
    from thorchain.swaps
    where from_asset = 'THOR.RUNE'
    ),
    in_out as(
    select * from in_thor
    union all
    select * from out_thor
    )

    select
    to_char(block_timestamp, 'yyyy-mm-dd') as date,
    from_asset,
    direction,
    sum(from_amount) as token,
    sum(from_amount_usd) as token_usd
    from in_out
    where direction = 'in'
    group by 1,2,3


    Run a query to Download Data