Yousefi_1994Terra 6 - Daily Swap From LUNA by Old Users
    Updated 2023-01-11
    with new_users as (
    select
    tx_sender as wallet_address,
    min(block_timestamp)::date as creation_date
    from terra.core.fact_transactions
    group by wallet_address
    ),
    new_user_list as (
    select
    wallet_address,
    creation_date
    from new_users
    where creation_date >= '2022-12-12'
    and creation_date < '2023-01-7'
    ),
    luna_price_usd as (
    select
    recorded_hour::date as days,
    avg(close) as price_usd
    from crosschain.core.fact_hourly_prices
    where id = 'terra-luna-2'
    and recorded_hour::date >= '2022-12-12'
    and recorded_hour::date < '2023-01-7'
    group by days
    ),
    luna_swaps as (
    select
    block_timestamp,
    tx_id,
    trader,
    from_amount/1e6 as amount,
    to_currency
    from terra.core.ez_swaps
    where from_currency = 'uluna'
    and tx_succeeded = true
    and block_timestamp::date >= '2022-12-12'
    Run a query to Download Data