nitsAnchor Collateralisation over time (past 90 days)
    Updated 2022-01-29
    select
    date(block_timestamp) as day , contract_label , sum(amt_net) as today_amt_net_movement,
    sum(amt_net_usd) as today_amt_net_movement_usd,
    sum(today_amt_net_movement/pow(10,6)) over (partition by contract_label order by day ) as cumulative_movement_in_M
    ,sum(today_amt_net_movement_usd/pow(10,6)) over (partition by contract_label order by day ) as cumulative_movement_usd_in_M
    from (select * ,
    case when event_type = 'withdraw' then amount*(-1)
    when event_type = 'provide' then amount
    end as amt_net
    ,
    case when event_type = 'withdraw' then amount_usd*(-1)
    when event_type = 'provide' then amount_usd
    end as amt_net_usd
    from anchor.collateral
    where block_timestamp > CURRENT_DATE -90 )
    GROUP by day, contract_label
    limit 200


    Run a query to Download Data