marquMarinade Growth - Stake Balance over time of whale accounts
    Updated 2023-04-03
    with

    stakes_start as (

    select distinct

    '{{start_date}}' ::date - 1 as date,
    last_value(signers[0]) over (partition by stake_account order by block_id) as wallet_address,
    stake_account,
    last_value(post_tx_staked_balance) over (partition by stake_account order by block_id, index) as post_tx_staked_balance,
    last_value(block_timestamp) over (partition by stake_account order by block_id) as block_timestamp,
    last_value(tx_id) over (partition by stake_account order by block_id) as tx_id,

    last_value(stake_active) over (partition by stake_account order by block_id, index) as stake_active

    from solana.core.ez_staking_lp_actions
    where succeeded
    and stake_active is not null
    and post_tx_staked_balance is not null
    and (block_timestamp ::date < '{{start_date}}' ::date
    or block_timestamp is null)
    qualify wallet_address <> 'mpa4abUkjQoAvPzREkh5Mo75hZhPFQ2FSH6w7dWKuQ5' -- Solana Foundation Wallet
    ),

    stakes_period as (

    select distinct

    block_timestamp ::date as date,
    last_value(signers[0]) over (partition by stake_account, block_timestamp ::date order by block_id) as wallet_address,
    stake_account,
    last_value(post_tx_staked_balance) over (partition by stake_account, block_timestamp ::date order by block_id, index) as post_tx_staked_balance,
    last_value(block_timestamp) over (partition by stake_account, block_timestamp ::date order by block_id) as block_timestamp,
    last_value(tx_id) over (partition by stake_account, block_timestamp ::date order by block_id) as tx_id,
    Run a query to Download Data