lidoLido Staked to/ Withdrawn from BC
    Updated 13 hours ago
    /*
    For better visualization, a 3-month period consists of the current month and the three months immediately preceding it
    Calculation logic:
    - create a date sequence to avoid the gaps in the data
    - declare Lido addresses
    - retrieve daily ETH deposits + cumulative amounts
    - retrieve Lido daily deposits + cumulative amounts
    - retrieve Lido daily withdrawals + cumulative withdrawal amount
    */

    -- date sequence for the past 3 months + current period
    WITH date_params AS (
    SELECT
    DATE_TRUNC('month', CURRENT_DATE) - INTERVAL '3 month' AS start_date,
    CURRENT_DATE AS end_date
    )

    , day_seq AS (
    SELECT
    DATEADD('day', SEQ4(), start_date) AS day
    FROM date_params, TABLE(GENERATOR(ROWCOUNT => 1000)) -- Large enough to cover 3 months + some
    )

    , dates as (
    SELECT
    day
    FROM day_seq
    WHERE day BETWEEN (SELECT start_date FROM date_params) AND (SELECT end_date FROM date_params)
    )

    -----------Deposits-----------

    -- calculates daily deposits for the past 3 months
    , all_deposits AS (
    SELECT
    Last run: about 13 hours agoAuto-refreshes every 24 hours
    DAY
    staked daily
    withdrawn daily
    daily net staked
    Lido share
    cumulative staked
    cumulative withdrawn
    cumulative net staked
    TOTAL_CUMULATIVE_DEPOSITS
    1
    2025-04-26 00:00:00.0000003.34689195177632-581599.997559693-403967.9975596935307371.8143
    2
    2025-04-25 00:00:00.0000003.347073576177632-581599.997559693-403967.9975596935307083.8143
    3
    2025-04-24 00:00:00.0000-6271.99999792-6271.999997923.36268539177632-581599.997559693-403967.9975596935282444.8143
    4
    2025-04-23 00:00:00.0000003.379186483177632-575327.997561773-397695.9975617735256649.8143
    5
    2025-04-22 00:00:00.0000-8640-86403.405075722177632-575327.997561773-397695.9975617735216682.8143
    6
    2025-04-21 00:00:00.0000-13536-135363.49230566177632-566687.997561773-389055.9975617735086381.8143
    7
    2025-04-20 00:00:00.0000-3648-36483.501914893177632-553151.997561773-375519.9975617735072424.8143
    8
    2025-04-19 00:00:00.0000-6208-62083.51337952177632-549503.997561773-371871.9975617735055872.8143
    9
    2025-04-18 00:00:00.0000-7520-75203.525766037177632-543295.997561773-365663.9975617735038110.8143
    10
    2025-04-17 00:00:00.0000-2112-21123.548644358177632-535775.997561773-358143.9975617735005629.8143
    11
    2025-04-16 00:00:00.0000-3520-35203.620083743177632-533663.997561773-356031.9975617734906847.8143
    12
    2025-04-15 00:00:00.0000-6048-60483.677943108177632-530143.997561773-352511.9975617734829656
    13
    2025-04-14 00:00:00.0000-3008-30083.712833157177632-524095.997561773-346463.9975617734784271
    14
    2025-04-13 00:00:00.0000003.765343501177632-521087.997561773-343455.9975617734717551
    15
    2025-04-12 00:00:00.0000-30656-306563.775248269177632-521087.997561773-343455.9975617734705174
    16
    2025-04-11 00:00:00.0000-26656-266563.787341556177632-490431.997561773-312799.9975617734690150
    17
    2025-04-10 00:00:00.0000-384-3843.809408617177632-463775.997561773-286143.9975617734662981
    18
    2025-04-09 00:00:00.0000003.970976852177632-463391.997561773-285759.9975617734473257
    19
    2025-04-08 00:00:00.0000-1056-10564.010675144177632-463391.997561773-285759.9975617734428980
    20
    2025-04-07 00:00:00.0000-1920-19204.055066836177632-462335.997561773-284703.9975617734380495
    ...
    116
    10KB
    80s