Select
stake_account,
node_pubkey,
validator_name,
(post_tx_staked_balance/1e9) as post_stake_balance,
date_trunc('day', block_timestamp) as day
From solana.core.ez_staking_lp_actions
where day >= CURRENT_DATE -7
and stake_active = 'True'
and max(day)
-- and node_pubkey != (is not paired with the same stake_account)
group by 1,2,3,4,5
order by post_stake_balance DESC
-- can vote account and stake account be the same, what's a node_pubkey verse a stake account_account?
-- I need the most receent post_stake_balance from each validator and/or stake account or stake_authority
-- Select *
-- From solana.core.ez_staking_lp_actions
-- where tx_id = '3TabzAHLViCcxPv3zqJHf2NM71mat37xcHTossULYHE1JratHX4WZeJTJUG7V3t3jN6ZxiwSqYtsMmbcpB7vZfot'
-- Select *
-- From solana.core.ez_staking_lp_actions
-- where stake_authority != withdraw_authority
-- with weekly_data as (
-- select
-- date_trunc('week',block_timestamp) as date_
-- ,stake_pool_name
-- ,case when action like '%deposit%' then 'Inflow' else 'Outflow' end as action_type
-- -- ,action
-- ,count(tx_id) as action_count
-- from solana.core.fact_stake_pool_actions
-- where 1=1