mlhorca
    Updated 2022-07-09
    with orca_cex as (
    select
    address,
    address_name
    from solana.core.dim_labels
    where label_type ='cex'),

    to_orca as (
    select
    date_trunc ('day',block_timestamp) as days,
    amount,
    tx_from
    from solana.core.fact_transfers
    where tx_from in (select address from orca_cex)
    and tx_to not in (select address from orca_cex)
    and mint = ('orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE')),

    from_orca as (
    select
    date_trunc ('day',block_timestamp) as days,
    amount,
    tx_from
    from solana.core.fact_transfers
    where tx_to in (select address from orca_cex)
    and tx_from not in (select address from orca_cex)
    and mint = ('orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE'))

    select days,
    'from orca' as type,
    sum(amount) as Volume,
    count(*) as TX_Count
    from from_orca
    group by 1
    UNION
    select
    days,
    Run a query to Download Data