saber-jltotal sell eth and flow
    Updated 2023-01-13
    with flowprice as(
    select
    date_trunc('day',RECORDED_HOUR) as date,
    avg(close) as flow_price
    from flow.core.fact_hourly_prices
    where token ilike 'flow'
    and date >= '2022-12-01'
    group by 1),
    flow as (
    select
    date_trunc('day',block_timestamp) as day,
    count(distinct TX_ID) as flow_sell_tx,
    count(distinct trader) as flow_seller,
    sum(TOKEN_OUT_AMOUNT*flow_price) as flow_usd_value
    from flow.core.ez_swaps s join flowprice f on s.block_timestamp::date = f.date
    where TOKEN_IN_CONTRACT = 'A.1654653399040a61.FlowToken'
    and day >= '2022-12-01'
    group by 1
    ),

    eth as (
    select
    date_trunc('day',block_timestamp) as edate,
    count(distinct TX_HASH) as eth_sell_tx,
    count(distinct ORIGIN_FROM_ADDRESS) as eth_seller,
    sum(AMOUNT_OUT_USD) as eth_in_usd
    from ethereum.core.ez_dex_swaps
    where SYMBOL_IN = 'WETH'
    and edate >= '2022-12-01'
    group by 1)

    select sum(eth_sell_tx), sum(eth_seller),sum(eth_in_usd),'eth' as type from eth
    union
    select sum(flow_sell_tx), sum(flow_seller), sum(flow_usd_value) ,'flow' as type from flow
    Run a query to Download Data