sarathaxl_token4.5
    Updated 2022-12-02
    with axl_price as (
    select
    date_trunc('day', recorded_at) as DATE,
    avg(price) as price
    from osmosis.core.dim_prices
    where symbol = 'AXL'
    group by 1
    )
    ,
    Osmosis_Activity as (
    select
    'SWAP' as Action,
    block_timestamp,
    tx_id,
    trader as User_address,
    to_amount/pow(10,to_decimal) * price as amount_usd
    from osmosis.core.fact_swaps a join axl_price b on a.block_timestamp::date = b.date
    where 1=1
    and
    from_currency = 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E'
    and
    tx_status = 'SUCCEEDED'

    union ALL

    select
    'Liquidity Providing' as Action,
    block_timestamp,
    tx_id,
    liquidity_provider_address as User_address,
    amount/pow(10,decimal) * price as amount_usd
    from osmosis.core.fact_liquidity_provider_actions a join axl_price b on a.block_timestamp::date = b.date
    where 1=1
    and
    currency = 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E'
    AND
    Run a query to Download Data