Nige777746 Bonded vs unbonded 1
    Updated 2021-08-18


    with cte_1 as (
    select distinct
    SUM(BALANCE) OVER (partition by Balance_type, date order by date) AS LUNA,
    SUM(BALANCE) OVER (partition by date order by date) AS TOTAL_SUPPLY,
    IFF(Balance_type = 'liquid','LUNA','BLUNA') AS L_TYPE,
    DATE
    from terra.daily_balances
    WHERE
    date > CURRENT_DATE -90
    and currency = 'LUNA'
    and balance > 0
    and balance_type ='liquid'
    and address != lower('terra1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3nln0mh')


    ),


    cte_2 as (
    select distinct
    SUM(BALANCE) OVER (partition by Balance_type, date order by date) AS bLUNA,
    SUM(BALANCE) OVER (partition by date order by date) AS b_TOTAL_SUPPLY,
    IFF(Balance_type = 'liquid','LUNA','BLUNA') AS B_TYPE,
    DATE as B_DATE
    from terra.daily_balances
    WHERE
    date > CURRENT_DATE -90
    and currency = 'LUNA'
    and balance > 0
    and balance_type ='staked'
    and address != lower('terra1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3nln0mh')


    Run a query to Download Data