mlhWhich assets are most commonly swapped for and transferred out?(monthly analysis)
    Updated 2023-01-04
    select date_trunc (month, transfer_date) as date,
    currency,
    project_name,
    count (distinct tx_id) as trxs,
    count (distinct sender) as users,
    sum (amount*usdprice/pow(10,t1.decimal)) as Volume,
    sum (trxs) over (partition by currency order by date) as Cum_tx,
    sum (Volume) over (partition by currency order by date) as Cum_volume
    from (select block_timestamp as transfer_date,
    t1.tx_id,
    sender,
    currency,
    amount,
    decimal
    from osmosis.core.fact_transfers t1 join (
    select block_timestamp as swap_date,
    tx_id,
    trader,
    to_currency,
    to_amount,
    to_decimal
    from osmosis.core.fact_swaps
    where tx_id in (select tx_id from (
    select * from (
    select block_timestamp,
    tx_id,
    tx_from,
    row_number () over (partition by tx_from order by block_timestamp) as rn
    from osmosis.core.fact_transactions)
    where rn in ('1','2')) where rn = '1')) t2 on t1.sender = t2.trader and t1.currency = t2.to_currency and t1.block_timestamp > t2.swap_date
    where transfer_type = 'IBC_TRANSFER_OUT'
    and t1.tx_id in (select tx_id from (
    select * from (
    select block_timestamp,
    tx_id,
    tx_from,
    Run a query to Download Data