davidwallUntitled Query
    Updated 2023-01-19
    --credit : https://app.flipsidecrypto.com/velocity/queries/14da1afc-8b29-4ed7-953a-21706f02e768
    with
    t1 as (
    select trunc(block_timestamp,'day') as date,
    sum(amount/pow(10,6)) as volume_transferred
    from terra.core.ez_transfers
    where block_timestamp>=current_date - 30 and currency='uluna'
    group by 1
    ),
    t2 as (
    select
    trunc(recorded_hour,'day') as date,
    avg(close) as eth_price,
    LAG(eth_price,1) IGNORE NULLS OVER (ORDER BY date) as last_price,
    ((eth_price-last_price)/eth_price)*100 as eth_price_change
    from crosschain.core.fact_hourly_prices where id='terra-luna-2' and date>=current_date - 30
    group by 1
    ),
    t4 as (
    select
    t1.date,
    volume_transferred,eth_price,eth_price_change
    from t1
    join t2 on t1.date=t2.date
    )
    select * from t4
    order by 1 asc
    Run a query to Download Data