Updated 2025-05-05
    with

    pricet as (
    select
    hour::date as date,
    symbol,
    asset_id,
    avg(price) as token_price_usd
    from
    stellar.price.ez_prices_hourly
    group by 1, 2, 3

    union all

    select
    hour::date as date,
    'XML' as symbol,
    -5706705804583548000 as asset_id,
    avg(price) as token_price_usd
    from
    crosschain.price.ez_prices_hourly
    where
    blockchain = 'stellar'
    and token_address is null
    group by 1, 2, 3
    ),

    main as (
    select
    history_operation_id,
    block_timestamp,
    buying_account_address as swapper,
    iff(selling_asset_type = 'native', 'XLM', nvl(selling_asset_code, p1.symbol)) as symbol_in,
    iff(buying_asset_type = 'native', 'XLM', nvl(buying_asset_code, p2.symbol)) as symbol_out,
    selling_amount as amount_in,
    buying_amount as amount_out,
    QueryRunArchived: QueryRun has been archived