0xaimanNumber of Address DCA Deposit per week vs ETH Price
    Updated 2022-09-05
    with a as (select block_timestamp, origin_from_address,tx_hash, origin_to_address, amount from
    ethereum.core.ez_eth_transfers
    where origin_to_address = '0x00000000219ab540356cbb839cbe05303d7705fa'
    or origin_to_address = lower('0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84')
    or origin_to_address = lower('0x4D05E3d48a938db4b7a9A59A802D5b45011BDe58')
    or origin_to_address = lower('0x84db6eE82b7Cf3b47E8F19270abdE5718B936670')
    or origin_to_address = lower('0x49D72e3973900A195A155a46441F0C08179FdB64')
    or origin_to_address = lower('0xC874b064f465bdD6411D45734b56fac750Cda29A')
    or origin_to_address = lower ('0xcBc1065255cBc3aB41a6868c22d1f1C573AB89fd')
    ),

    b as ( select block_timestamp as t, tx_hash,origin_from_address, case when origin_to_address = '0x00000000219ab540356cbb839cbe05303d7705fa' then 'Direct Staking'
    when origin_to_address = lower('0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84') then 'Lido '
    when origin_to_address = lower('0x4D05E3d48a938db4b7a9A59A802D5b45011BDe58') then 'Rocket Pool '
    when origin_to_address = lower('0x84db6eE82b7Cf3b47E8F19270abdE5718B936670') then 'Cream Finance 2.0'
    when origin_to_address = lower('0x49D72e3973900A195A155a46441F0C08179FdB64') then 'stkr '
    when origin_to_address = lower('0xC874b064f465bdD6411D45734b56fac750Cda29A') then 'Stakewise'
    when origin_to_address = lower ('0xcBc1065255cBc3aB41a6868c22d1f1C573AB89fd') then 'Cream Finance 1.0 '

    else null end as staking_platform
    , amount
    from a
    )
    ,
    c as (select origin_from_address, staking_platform, count(tx_hash) as deposit_txn_count
    from b
    group by 1,2 order by 1),

    d as (select date_trunc('week',t) as date, b.staking_platform, count(distinct c.origin_from_address ) as n_dca_address
    from b inner join c on b.origin_from_address=c.origin_from_address
    where deposit_txn_count>1
    group by 1,2 order by 1)

    , e as (select date_trunc('week',hour) as d,avg(price) as price_eth from ethereum.core.fact_hourly_token_prices
    Run a query to Download Data