Flipside Team2012 CEXs
    Updated 2024-04-18
    with
    -------------------- Dates --------------------
    dates as (
    select
    date_day as date,
    case
    when date_day < '2012-11-28' then 'Pre-Halving'
    when date_day = '2012-11-28' then 'Halving'
    when date_day > '2012-11-28' then 'Post-Halving'
    end as period
    from
    crosschain.core.dim_dates
    where
    date_day between ('2012-11-28'::date - 30) and ('2012-11-28'::date + 30)
    ),
    -------------------- Raw Transfers --------------------
    inputs as (
    select
    inputs.block_timestamp,
    labels.address,
    labels.label as cex,
    inputs.value
    from
    bitcoin.core.fact_inputs inputs
    join bitcoin.core.dim_labels labels on inputs.pubkey_script_address = labels.address
    where
    label_type = 'cex'
    ),
    outputs as (
    select
    outputs.block_timestamp,
    labels.address,
    labels.label as cex,
    outputs.value
    from
    bitcoin.core.fact_outputs outputs
    QueryRunArchived: QueryRun has been archived