h4wksol change total
    Updated 2025-01-15
    -- forked from sol change over time @ https://flipsidecrypto.xyz/studio/queries/b60b5fea-f979-4dc4-89e2-16a57959a8c6

    with base as (
    select d.value:"DATE" as date,
    d.value:"ADDRESS" as address,
    d.value:"TX_COUNT" as tx_count,
    d.value:"TOTAL_INFLOW_SOL" as total_inflow_sol,
    d.value:"TOTAL_OUTFLOW_SOL" as total_outflow_sol,
    d.value:"TOTAL_CHANGE_SOL" as total_change_sol
    from (
    select * from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/v1/queries/58b48713-93fe-49ba-8c96-a647ea4732ea/data/latest'):"data" as data) responses join lateral flatten (input => responses.data) UNION
    select * from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/v1/queries/58b48713-93fe-49ba-8c96-a647ea4732ea/data/latest'):"data" as data) responses join lateral flatten (input => responses.data) UNION
    select * from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/v1/queries/4f5454b1-205b-47d9-a76d-a8c30c1e2ff9/data/latest'):"data" as data) responses join lateral flatten (input => responses.data) UNION
    select * from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/v1/queries/3b3911f9-8c29-4f14-8047-d3184573a2e1/data/latest'):"data" as data) responses join lateral flatten (input => responses.data) UNION
    select * from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/v1/queries/b4be7c65-cc19-425b-80f8-c912e7977d93/data/latest'):"data" as data) responses join lateral flatten (input => responses.data) UNION
    select * from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/v1/queries/bbfb4833-a487-4bfa-8575-082c94e7ad64/data/latest'):"data" as data) responses join lateral flatten (input => responses.data) UNION
    select * from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/v1/queries/8edd919a-89ba-42ba-a5d3-77bb936233c5/data/latest'):"data" as data) responses join lateral flatten (input => responses.data) UNION
    select * from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/v1/queries/9b55c321-a9d0-45b8-9e87-4548fd90c88e/data/latest'):"data" as data) responses join lateral flatten (input => responses.data)
    ) d
    )

    select
    sum(tx_count) as total_tx,
    sum(total_change_sol) as total_sol,
    total_sol / count(distinct date) as avg_daily_sol,
    total_sol / total_tx as sol_per_tx,
    min(date) as first_tx,
    max(date) as last_tx
    from base


    QueryRunArchived: QueryRun has been archived