ashpeezeyGetting Started
    Updated 2023-04-11
    select
    t5.dt,
    t5.pair,
    t5.buy_total as buy_total,
    t5.sell_total as sell_total,
    t5.cvd_sol as net_sol,
    t5.buy_notional_total as buy_notional_total,
    t5.sell_notional_total as sell_notional_total,
    t5.cvd_notional as net_notional,
    sum(t5.buy_total) over (order by t5.dt asc) as buy_cumulative,
    sum(t5.sell_total) over (order by t5.dt asc) as sell_cumulative,
    sum(t5.cvd_sol) over (order by t5.dt asc) as cvd_sol,
    sum(t5.buy_notional_total) over (order by t5.dt asc) as buy_notional_cumulative,
    sum(t5.sell_notional_total) over (order by t5.dt asc) as sell_notional_cumulative,
    sum(t5.cvd_notional) over (order by t5.dt asc) as cvd_notional
    from (
    select
    t2.dt,
    t2.pair,
    t2.buy_total,
    t4.sell_total,
    t2.buy_total + t4.sell_total as cvd_sol,
    t2.buy_notional_total,
    t4.sell_notional_total,
    t2.buy_notional_total + t4.sell_notional_total as cvd_notional
    from (
    select
    date_trunc('day', t1.block_timestamp) as dt,
    t1.type,
    t1.pair,
    sum(t1.quantity) as buy_total,
    sum(t1.notional) as buy_notional_total,
    count(*) as buy_txs
    from (
    select
    block_timestamp,
    Run a query to Download Data