samosmosis swaps table with homemade usd prices
    Updated 2022-10-21
    with raw_swaps as (
    select
    block_timestamp,
    tx_id,

    from_amount / pow(10, from_decimal) as from_amount_adj,
    from_currency,
    l.project_name as from_currency_name,

    to_amount / pow(10 , to_decimal) as to_amount_adj,
    to_currency,
    m.project_name as to_currency_name
    from osmosis.core.fact_swaps s
    left join osmosis.core.dim_labels l on s.from_currency = l.address
    left join osmosis.core.dim_labels m on s.from_currency = m.address
    where block_timestamp >= '2022-10-01'
    and tx_status = 'SUCCEEDED'
    ),

    daily_osmo_price_raw as (
    select
    block_timestamp,
    tx_id,

    from_amount_adj,
    from_currency,
    from_currency_name,

    to_amount_adj,
    to_currency,
    to_currency_name,

    case when from_currency = 'uosmo' then to_amount_adj/from_amount_adj
    else to_amount_adj/from_amount_adj end as osmo_daily_price_raw
    Run a query to Download Data