emirprince95Interacting Addresses and their Balances
    Updated 2021-10-10
    SELECT date, address, balance, balance_usd, currency FROM
    terra.daily_balances
    WHERE address IN
    -- this achieves the condition for being active in the last 90 days (operationalized as having more than 0 USD in total balance)
    (SELECT address FROM
    terra.daily_balances
    WHERE date_trunc('day', date) >= date_trunc('day', current_date) - 90 AND balance_usd != 0
    GROUP BY address)
    AND
    -- this only retreieves the entries within 90 days
    date_trunc('day', date) >= date_trunc('day', current_date) - 90
    AND
    balance_usd != 0
    Run a query to Download Data