eferUSD amounts | Kashi Market | Polygon
    Updated 2023-04-06
    WITH collateralized AS (
    SELECT
    BLOCK_TIMESTAMP::date AS date,
    SUM(AMOUNT_USD) AS usd_amount,
    SUM(usd_amount) OVER(ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_usd
    FROM
    polygon.sushi.ez_lending
    WHERE
    ACTION='Deposit'
    AND SYMBOL IN (
    'DAI',
    'USDT',
    'USDC',
    'sUSD',
    'TUSD',
    'UST',
    'FEI'
    )
    GROUP BY date
    ), borrowed AS (
    SELECT
    BLOCK_TIMESTAMP::date AS date,
    COALESCE(SUM(AMOUNT_USD), 0) AS usd_amount
    FROM
    polygon.sushi.ez_borrowing
    WHERE
    ACTION='Borrow'
    AND SYMBOL IN (
    'DAI',
    'USDT',
    'USDC',
    'sUSD',
    'TUSD',
    'UST',
    'FEI'
    )
    Run a query to Download Data