kiacryptoFlowing in and out of the Mango Market since beginning of 2022
    Updated 2022-07-10
    -- credit m.zamani
    with inflow as(
    select block_timestamp::date as day, sum(inner_instruction:instructions[0]:parsed:info:amount/1e9) as amount_in
    from solana.core.fact_events
    Where block_timestamp::date >='2022-01-01' AND program_id = 'mv3ekLzLbnVPNxjSKvqBpU3ZeZXPQdEC3bp5MDEBG68'
    AND inner_instruction:instructions[0]:parsed:info:destination = 'AVn3JRGhifPCxjxZsU3tQuo4U4dTHizHzBDGW983tx47'
    group by 1
    ),

    outflow as(
    select block_timestamp::date as day, sum(inner_instruction:instructions[0]:parsed:info:amount/1e9) as amount_out
    from solana.core.fact_events
    Where block_timestamp::date >='2022-01-01' AND program_id = 'mv3ekLzLbnVPNxjSKvqBpU3ZeZXPQdEC3bp5MDEBG68'
    AND inner_instruction:instructions[0]:parsed:info:source = 'AVn3JRGhifPCxjxZsU3tQuo4U4dTHizHzBDGW983tx47'
    group by 1
    )

    select inflow.day as day,
    amount_in as inflow,
    -amount_out as outflow
    from inflow
    inner join outflow on inflow.day=outflow.day
    Run a query to Download Data