iboo-jbj2MV Anchor Collateralization
    Updated 2022-02-03
    With bluna_pr AS
    (
    SELECT
    date_trunc('day', block_timestamp) AS Dt,
    CASE WHEN event_type='provide' THEN sum(amount)
    END AS Provided_bluna
    FROM anchor.collateral
    WHERE currency=('terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp') and event_type='provide'
    GROUP BY dt, event_type
    ORDER BY dt DESC
    ),
    bluna_w AS
    (
    SELECT
    date_trunc('day', block_timestamp) AS Dte,
    CASE WHEN event_type='withdraw' THEN SUM(amount)
    END AS withdrawed_bluna
    FROM anchor.collateral
    WHERE currency=('terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp') and event_type='withdraw'
    GROUP BY dte, event_type
    ORDER BY dte DESC
    ),
    beth_pr AS
    (
    SELECT
    date_trunc('day', block_timestamp) AS Dtt,
    CASE WHEN event_type='provide' THEN sum(amount)
    END AS Provided_beth
    FROM anchor.collateral
    WHERE currency=('terra1dzhzukyezv0etz22ud940z7adyv7xgcjkahuun') and event_type='provide'
    GROUP BY dtt, event_type
    ORDER BY dtt DESC
    ),
    Run a query to Download Data