tongzzezCopy of DCA
    Updated 2022-09-04
    with all_tx as(
    select
    case
    when eth_to_address = '0xc874b064f465bdd6411d45734b56fac750cda29a' then '1.Stakewise'
    when eth_to_address = '0x84db6ee82b7cf3b47e8f19270abde5718b936670' then '2.stkr'
    when eth_to_address = '0xcbc1065255cbc3ab41a6868c22d1f1c573ab89fd' then '3.Cream'
    when eth_to_address = '0x4d05e3d48a938db4b7a9a59a802d5b45011bde58' then '4.Rocket_pool'
    when eth_to_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' then '5.Lido'
    when eth_to_address = '0x00000000219ab540356cbb839cbe05303d7705fa' then '6.Direct staking'
    else 'no information'
    end as platform,
    block_timestamp,
    tx_hash,
    origin_from_address,
    amount,
    amount_usd,
    row_number() over(partition by origin_from_address order by block_timestamp) as roww,
    count(1) over(partition by origin_from_address) as max_row
    -- amount,
    -- amount_usd
    from
    ethereum.core.ez_eth_transfers
    where
    eth_to_address in ('0xc874b064f465bdd6411d45734b56fac750cda29a', '0x84db6ee82b7cf3b47e8f19270abde5718b936670', '0xcbc1065255cbc3ab41a6868c22d1f1c573ab89fd', '0x4d05e3d48a938db4b7a9a59a802d5b45011bde58', '0xae7ab96520de3a18e5e111b5eaab095312d7fe84', '0x00000000219ab540356cbb839cbe05303d7705fa')
    -- and roww =1
    -- and not eth_from_address in ('0xc874b064f465bdd6411d45734b56fac750cda29a', '0x84db6ee82b7cf3b47e8f19270abde5718b936670', '0xcbc1065255cbc3ab41a6868c22d1f1c573ab89fd', '0x4d05e3d48a938db4b7a9a59a802d5b45011bde58', '0xae7ab96520de3a18e5e111b5eaab095312d7fe84', '0x00000000219ab540356cbb839cbe05303d7705fa')
    order by
    max_row desc, roww
    )
    , min_time as (
    SELECT
    min(block_timestamp) as min_time,
    origin_from_address,
    max_row
    from
    all_tx
    Run a query to Download Data