danielrMonthly supplied and withdrawn
    Updated 2023-06-05
    -- forked from Weekly supplied and withdrawn @ https://flipsidecrypto.xyz/edit/queries/f9522b01-2111-41df-b827-ced9bf32f66f

    -- forked from Daily supplied and withdrawn @ https://flipsidecrypto.xyz/edit/queries/eb892687-ad4e-4828-8cf4-ca01b7cf6965

    with A as (
    SELECT
    date_trunc('{{Date_Trunc}}',block_timestamp) as date,
    sum(ISSUED_TOKENS) as Amount_Token,
    sum(SUPPLIED_USD) as Amount_USD,
    'Supplied' as label
    from ethereum.aave.ez_deposits
    where SYMBOL='AAVE'
    and block_timestamp>=CURRENT_DATE - {{Period_From_Current_Date_monthly}}
    group by 1
    ),
    B as(
    SELECT
    date_trunc('{{Date_Trunc}}',block_timestamp) as date,
    sum(WITHDRAWN_TOKENS) as Amount_Token,
    sum(WITHDRAWN_USD) as Amount_USD,
    'Withdrawn' as label
    from ethereum.aave.ez_withdraws
    where SYMBOL='AAVE'
    and block_timestamp>=CURRENT_DATE - {{Period_From_Current_Date_monthly}}
    group by 1
    ),
    C as(
    select * from A
    union all
    select * from B
    )
    select * from C



    Run a query to Download Data