Balances Latest

The balances latest table contains the latest balances of every type of token of any address. This includes Native Ether, ERC20, ERC721, and ERC1155 tokens.

For the value of the asset balances, there are two USD balance fields:

  • usd_balance_current which reflects the current USD value of the asset.

  • usd_balance_at_block_timestamp which reflects the USD value of the asset at the last transaction activity.

Sample Query

Finding the distribution of current ETH holdings amongst users who bought an NFT on OpenSea in the last 7 days.

select 
  case 
  when balance <= 1 then 'a. <1 MATIC'
  when balance > 1 and balance <= 100 then 'b. >1-100 MATIC'
  when balance > 100 and balance <= 1000 then 'c. >100-1k MATIC'
  when balance > 1000 and balance <= 10000 then 'd. >1k-10k MATIC'
  when balance > 10000 then 'e. >10k MATIC' end as matic_holdings,
  count(distinct address) as address_count
from 
  polygon.assets.balances_latest 
where 
  token_type = 'MATIC'
  and token_address = '0x0000000000000000000000000000000000000000'
  and address IN ( -- selecting address of Opensea buyers in the last 7 days 
    select 
      distinct buyer_address 
    from 
      polygon.nfts.trades 
    where 
      usd_price > 0 
      and current_date - date(block_timestamp) < 7
      and marketplace = 'opensea'
  )
group by matic_holdings
order by matic_holdings asc

Table Columns

Last updated