emirprince95All Anchor Liquidations
    Updated 2021-12-29
    with liquidations as (
    select date_trunc('HOUR', block_timestamp) as block_timestamp, sum(liquidated_amount_usd) as liquidated_amount_usd
    from anchor.liquidations
    group by date_trunc('HOUR', block_timestamp), liquidated_currency)

    , beth_price as (
    select date_trunc('HOUR', block_timestamp) as block_timestamp, price_usd as bluna_price_usd from terra.oracle_prices
    where symbol = 'bLUNA')
    , bluna_price as (
    select date_trunc('HOUR', block_timestamp) as block_timestamp, price_usd as beth_price_usd from terra.oracle_prices
    where symbol = 'bETH token contract'
    )

    , bonded_assets_price as (
    select eth.*, luna.beth_price_usd from beth_price eth join bluna_price luna
    on luna.block_timestamp=eth.block_timestamp
    )
    select li.*, bp.beth_price_usd, bp.bluna_price_usd from liquidations li join bonded_assets_price bp on li.block_timestamp=bp.block_timestamp

    --select * from bonded_assets_price limit 10
    Run a query to Download Data