elvisTotal volume of address in USD grouped by the number of currencies they transacted with in the past 90 days excluding FAILED transactions (no split)
    Updated 2021-10-11
    /*Over the last 90 days, for each active address on Terra, characterize the # Currencies Transacted with, as well as frequency and volume of those transactions [address x currency x stat]*/
    WITH addresses_currencies AS
    (
    SELECT event_from, count(DISTINCT event_currency) AS NumCurrency
    FROM terra.transfers
    WHERE date_trunc('day', block_timestamp) >= CURRENT_DATE - 90 AND tx_status = 'SUCCEEDED'
    GROUP BY 1
    )
    SELECT
    NumCurrency, sum(event_amount_usd) as TotalVolume
    FROM terra.transfers AS t INNER JOIN addresses_currencies AS a ON t.event_from = a.event_from
    WHERE date_trunc('day', block_timestamp) >= CURRENT_DATE - 90 AND tx_status = 'SUCCEEDED'
    GROUP BY 1
    ORDER BY 1

    Run a query to Download Data