SocioAnalyticajoint histograms by bridge - buckets renamed
    Updated 2025-02-03
    -- forked from SocioCrypto / joint histograms by bridge @ https://flipsidecrypto.xyz/SocioCrypto/q/NRtlXi1QljZ4/joint-histograms-by-bridge

    -- forked from elvis / joint histograms by chain @ https://flipsidecrypto.xyz/elvis/q/jrLlPuay_HDx/joint-histograms-by-chain

    WITH outgoing_histograms AS (
    SELECT
    bridge,
    'out' || CASE size_bucket
    WHEN '0-100' THEN '0-1K'
    WHEN '100-500' THEN '0-1K'
    WHEN '500-1K' THEN '0-1K'
    WHEN '1K-5K' THEN '1K-10K'
    WHEN '5K-10K' THEN '1K-10K'
    WHEN '10K+' THEN '10K+' END as size_bucket,
    CASE size_bucket
    WHEN '0-100' THEN 4
    WHEN '100-500' THEN 4
    WHEN '500-1K' THEN 4
    WHEN '1K-5K' THEN 5
    WHEN '5K-10K' THEN 5
    WHEN '10K+' THEN 6 END as size_bucket_order,
    sum(tx_count) as tx_count,
    sum(total_volume) as total_volume
    FROM $query('57999564-76aa-4577-a112-e6ca35a4a580')
    GROUP BY 1,2,3
    ),
    incoming_histograms AS (
    SELECT
    bridge,
    'in_' || CASE size_bucket
    WHEN '0-100' THEN '0-1K'
    WHEN '100-500' THEN '0-1K'
    WHEN '500-1K' THEN '0-1K'
    WHEN '1K-5K' THEN '1K-10K'
    WHEN '5K-10K' THEN '1K-10K'
    WHEN '10K+' THEN '10K+' END as size_bucket,
    Last run: 2 months ago
    BRIDGE
    SIZE_BUCKET
    SIZE_BUCKET_ORDER
    TX_COUNT
    TOTAL_VOLUME
    1
    relayin_0-1K114228193.799016035
    2
    symbiosisin_0-1K186265452.326484821
    3
    lifuelin_0-1K147.651114005
    4
    stargateV2Busin_0-1K19355976799.162702345
    5
    stargateV2in_0-1K14229558808.888725047
    6
    stargateV2Busin_1K-10K26031986603.34534994
    7
    stargateV2in_1K-10K24281107013.75890517
    8
    symbiosisin_1K-10K272259808.97203968
    9
    relayin_1K-10K252181594.448262675
    10
    relayin_10K+3355446.911339027
    11
    symbiosisin_10K+314404277.051703457
    12
    stargateV2Busin_10K+319610474921.2879475
    13
    stargateV2in_10K+31027509164.22707236
    14
    lifuelout0-1K455.051372471
    15
    stargateV2out0-1K43352488274.189041358
    16
    stargateV2Busout0-1K46674781229.673495721
    17
    relayout0-1K4904927.114475926
    18
    symbiosisout0-1K435130378.802418516
    19
    symbiosisout1K-10K541136877.718999468
    20
    stargateV2out1K-10K54441169665.51144645
    25
    1KB
    2s