barbodalgooooooooo1
    Updated 2022-03-12
    with to_dex as (
    SELECT
    BLOCK_TIMESTAMP::date as dt,
    sum(amount) as Algo_amount
    FROM algorand.payment_transaction
    where block_timestamp >= '2022-02-10' AND block_timestamp <= '2022-02-17'
    and amount is not null
    and sender in (select address from algorand.labels where LABEL_TYPE = 'cex' )
    and receiver not in (select address from algorand.labels where LABEL_TYPE = 'cex')
    group by dt
    order by dt
    ),

    to_cex as (
    SELECT
    BLOCK_TIMESTAMP::date as dt1,
    sum(amount) as Algo_amount1
    FROM algorand.payment_transaction
    where block_timestamp >= '2022-02-10' AND block_timestamp <= '2022-02-17'
    and amount is not null
    and RECEIVER in (select address from algorand.labels where LABEL_TYPE = 'cex' )
    and SENDER not in (select address from algorand.labels where LABEL_TYPE = 'cex')

    group by dt1
    order by dt1
    )

    select
    d.dt as timeframe,

    round(d.Algo_amount) as to_dex,
    round(c.Algo_amount1) as to_cex
    from to_dex d join to_cex c on d.dt = c.dt1
    group by 1,2,3
    order by 1

    Run a query to Download Data