cybergenlabGMX Vault Assets AUM Size
    Updated 2024-02-16
    --Querying GMX Vault Assets AUM size

    with tokens(contract_address, symbol, decimals, underlying_name) as (
    select * from
    values
    (lower('0xff970a61a04b1ca14834a43f5de4533ebddb5cc8'), 'USDC', 6, 'USDC.e'),
    (lower('0xaf88d065e77c8cc2239327c5edb3a432268e5831'), 'USDC', 6, 'USDC'),
    (lower('0x82af49447d8a07e3bd95bd0d56f35241523fbab1'), 'WETH', 18, 'WETH'),
    (lower('0xda10009cbd5d07dd0cecc66161fc93d7c9000da1'), 'DAI', 18, 'DAI'),
    (lower('0xf97f4df75117a78c1a5a0dbb814af92458539fb4'), 'LINK', 18, 'LINK'),
    (lower('0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9'), 'USDT', 6, 'USDT'),
    (lower('0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0'), 'UNI', 18, 'UNI'),
    (lower('0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a'), 'MIM', 18, 'MIM'),
    (lower('0x17fc002b466eec40dae837fc4be5c67993ddbd6f'), 'FRAX', 18, 'FRAX'),
    (lower('0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f'), 'WBTC', 8, 'WBTC')
    ),

    event_table as (
    select
    date_trunc('day', block_timestamp) as time,
    event_name,
    get(get(get(full_decoded_log, 'data'), 0), 'value') as token_address,
    get(get(get(full_decoded_log, 'data'), 1), 'value') as amount
    --tx_hash,
    --full_decoded_log,
    from arbitrum.core.ez_decoded_event_logs
    where contract_address = lower('0x489ee077994B6658eAfA855C308275EAd8097C4A')
    and event_name in ('DecreasePoolAmount', 'IncreasePoolAmount')
    -- limit 1000
    )


    select time, sum(token_value_cumulative)/pow(10, 8) as total_aum_size
    from (
    select
    glp_flows.time,
    Last run: over 1 year ago
    TIME
    TOTAL_AUM_SIZE
    1
    2024-02-16 00:00:00.000319.215593892
    2
    2024-02-15 00:00:00.000318.268889921
    3
    2024-02-14 00:00:00.000312.280737268
    4
    2024-02-13 00:00:00.000307.785962822
    5
    2024-02-12 00:00:00.000301.320280152
    6
    2024-02-11 00:00:00.000299.50258192
    7
    2024-02-10 00:00:00.000298.060154096
    8
    2024-02-09 00:00:00.000296.060530403
    9
    2024-02-08 00:00:00.000291.786623097
    10
    2024-02-07 00:00:00.000286.569767424
    11
    2024-02-06 00:00:00.000283.910985327
    12
    2024-02-05 00:00:00.000281.885497549
    13
    2024-02-04 00:00:00.000281.47025414
    14
    2024-02-03 00:00:00.000282.109952529
    15
    2024-02-02 00:00:00.000281.826919497
    16
    2024-02-01 00:00:00.000278.658296444
    17
    2024-01-31 00:00:00.000280.872431766
    18
    2024-01-30 00:00:00.000281.850709205
    19
    2024-01-29 00:00:00.000278.728148824
    20
    2024-01-28 00:00:00.000276.83596171
    ...
    900
    36KB
    76s