Ali3NXSGD TVL / Market Cap / DEX Pools Correlation Over Time
    Updated 2025-03-18
    with poolst as (
    select *
    from avalanche.defi.dim_dex_liquidity_pools
    where tokens:token0 = '0xb2f85b7ab3c2b6f62df06de6ae7d09c010a5096e'
    or tokens:token1 = '0xb2f85b7ab3c2b6f62df06de6ae7d09c010a5096e'),

    depositst as (
    select date_trunc ({{Date_Trunc}},block_timestamp) as date1,
    initcap(platform) || ' | ' || Pool_name as LP_Name,
    sum (amount) as Deposited_Volume,
    sum (amount_usd) as Deposited_Volume_USD,
    sum (Deposited_Volume) over (partition by lp_name order by date1) as Cumulative_Deposited_Volume,
    sum (Deposited_Volume_USD) over (partition by lp_name order by date1) as Cumulative_Deposited_Volume_USD
    from avalanche.core.ez_token_transfers t1 join poolst t2 on t1.to_address = t2.pool_address
    where contract_address = '0xb2f85b7ab3c2b6f62df06de6ae7d09c010a5096e'
    group by 1,2),

    withdrawst as (
    select date_trunc ({{Date_Trunc}},block_timestamp) as date1,
    initcap(platform) || ' | ' || Pool_name as LP_Name,
    sum (amount) as Withdrawn_Volume,
    sum (amount_usd) as Withdrawn_Volume_USD,
    sum (Withdrawn_Volume) over (partition by lp_name order by date1) as Cumulative_Withdrawn_Volume,
    sum (Withdrawn_Volume_USD) over (partition by lp_name order by date1) as Cumulative_Withdrawn_Volume_USD
    from avalanche.core.ez_token_transfers t1 join poolst t2 on t1.from_address = t2.pool_address
    where contract_address = '0xb2f85b7ab3c2b6f62df06de6ae7d09c010a5096e'
    group by 1,2),

    finalpoolst as (
    select coalesce (t1.date1,t2.date1) as date,
    sum (coalesce (deposited_volume,0) - coalesce (withdrawn_volume,0)) as xsgd_Balance,
    sum (coalesce (deposited_volume_usd,0) - coalesce (withdrawn_volume_usd,0)) as xsgd_Balance_USD,
    sum (coalesce (Cumulative_Deposited_Volume,0) - coalesce (Cumulative_Withdrawn_Volume,0)) as Cumulative_xsgd_Balance,
    sum (coalesce (Cumulative_Deposited_Volume_USD,0) - coalesce (Cumulative_Withdrawn_Volume_USD,0)) as Cumulative_xsgd_Balance_USD,
    from depositst t1 full outer join withdrawst t2 on t1.lp_name = t2.lp_name and t1.date1 = t2.date1
    group by 1),
    Last run: about 1 month ago
    DATE
    TVL
    MARKET_CAP
    XSGD_BALANCE
    CUMULATIVE_XSGD_BALANCE
    1
    2025-02-17 00:00:00.0005424049.674050021.2715211-405124.1588479992263310.94305806
    2
    2025-02-10 00:00:00.0007424049.675500734.53021662-2438937.6754012668435.10190606
    3
    2025-02-03 00:00:00.0008924049.676596367.48444972-1704209.9469995107372.87001205
    4
    2025-01-20 00:00:00.00010224049.677551580.21473387-4632631.677342986015829.96935803
    5
    2025-01-13 00:00:00.00015224049.6711131695.71428183751046.8787800110648458.893127
    6
    2025-01-06 00:00:00.00011524049.678420738.3343657-475059.9800849996897412.47326501
    7
    2024-12-30 00:00:00.00011024049.678065575.06828561452198.4442330027372474.589582
    8
    2024-12-09 00:00:00.00010724049.677978918.159523076331625.5457167778308.108593
    9
    2024-11-11 00:00:00.00038439702867196.081165240233.4488571391371.8608
    10
    2024-11-04 00:00:00.00036439702754367.603934836.2993771151138.411943
    11
    2024-10-21 00:00:00.00016439701245158.49571595759.530818870652.134096
    12
    2024-10-14 00:00:00.00015239701161627.082875-18530.72991774892.603278
    13
    2024-10-07 00:00:00.00019239701473174.2091522335.028288793423.333188
    14
    2024-09-30 00:00:00.00018739701447110.554505190455.174395771088.3049
    15
    2024-09-23 00:00:00.00016077641252319.53488-57900.94915580633.130505
    16
    2024-09-16 00:00:00.00015500001198955.225-48790.90959638533.757083
    17
    2024-09-02 00:00:00.000850000651551.350.9719060.971906
    17
    1KB
    18s