bachifees kashi ethereum
    Updated 2022-07-13
    with borrows as (
    select
    a.lending_pool as kashi_market,
    sum(b.tx_fee) as total_fee,
    avg(b.tx_fee) as avg_fee
    from flipside_prod_db.crosschain.ez_borrowing a
    join ethereum.core.fact_transactions b
    on a.tx_hash=b.tx_hash
    where a.blockchain = 'ethereum'
    and a.lending_pool like '%km%'
    group by kashi_market
    order by total_fee desc
    ),
    lendings as (
    select a.lending_pool as kashi_market,
    sum(b.tx_fee) as total_fee,
    avg(b.tx_fee) as avg_fee
    from flipside_prod_db.crosschain.ez_lending a
    join ethereum.core.fact_transactions b
    on a.tx_hash=b.tx_hash
    where a.blockchain = 'ethereum'
    and a.lending_pool like '%km%'
    group by kashi_market
    order by total_fee desc --limit 10
    )

    select a.kashi_market, round((a.total_fee + b.total_fee),2) as fees from borrows a
    join lendings b on a.kashi_market = b.kashi_market order by fees desc --limit 10
    Run a query to Download Data