freemartianUntitled Query
    Updated 2022-08-18
    with inbound as (
    select
    date_trunc('month', block_timestamp::date) as period,
    sum(amount) as total_amount,
    token_contract
    from flow.core.fact_bridge_transactions
    where direction = 'inbound'
    group by token_contract, period
    ),
    outbound as (
    select
    date_trunc('month', block_timestamp::date) as period,
    sum(amount) as total_amount,
    token_contract
    from flow.core.fact_bridge_transactions
    where direction = 'outbound'
    group by token_contract, period
    )

    select
    i.period,
    i.token_contract,
    o.token_contract,
    i.total_amount as inflow,
    o.total_amount as outflow
    from inbound i
    left join outbound o on (i.period = o.period and i.token_contract = o.token_contract)
    Run a query to Download Data