nits2023-04-23 12:07 PM
    Updated 2023-04-23
    with data_ as
    (SELECT date(hour) as day , token_address as ta, avg(price) as avg_price,avg(decimals) as decimal from ethereum.core.fact_hourly_token_prices
    GROUP by 1,2 ),
    data_p as
    (SELECT date(hour) as day , token_address as ta, avg(price) as avg_price,avg(decimals) as decimal from polygon.core.fact_hourly_token_prices
    GROUP by 1,2 ),
    data_o as
    (SELECT date(recorded_hour) as day , currency as ta, avg(price) as avg_price from osmosis.core.ez_prices
    GROUP by 1,2 ),
    data_t as (
    SELECT date(block_timestamp) as day , currency as ta, avg(price_usd) as avg_price from terra.classic.dim_oracle_prices
    GROUP by 1,2),
    data_n as
    (SELECT date(timestamp) as day , token_contract as ta, avg(price_usd) as avg_price from near.core.fact_prices
    GROUP by 1,2 ),
    data_s as
    (SELECT date(recorded_hour) as day , token_address as ta, avg(close) as avg_price from solana.core.ez_token_prices_hourly
    GROUP by 1,2),
    data_f as
    (SELECT date(recorded_hour) as day , token as ta, avg(high) as avg_price from flow.core.fact_hourly_prices
    GROUP by 1,2),
    eth_total as
    (SELECT day,sum(net_price) as total_, sum(total_) over (order by day) as cum_received from
    (SELECT *, raw_amount/pow(10,decimal)*avg_price as net_price from
    (SELECT * from
    (SELECT *
    from ethereum.core.fact_token_transfers
    where (from_address =lower('0xD152f549545093347A162Dce210e7293f1452150') or from_address = lower('0x4faFB87de15cFf7448bD0658112F4e4B0d53332c') )
    and (to_address = '0xea0bce1a4439304052dad4114af345da40160812'
    or to_address = lower('0x441Bf908e098d9675B6bf7579815658dFD4e06F3')
    or to_address = lower('0x3d8bf74103c5e87d0b9bfb5f44d1bcd45c603304')
    or to_address = lower('0x7d35e6f0c256ef24a5fa9e6f72ea8b9dfce1e6b4')
    )
    ) join data_
    on contract_address = ta and date(block_timestamp) = day ))
    GROUP by 1),
    Run a query to Download Data