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

Column NameDescriptionExample
addressAddress of the account.0x66a84d487780c088d862971045d84b02d9b25aab
token_address

Address of the token.

For Ether it is represented as nulll address.

0x0000000000000000000000000000000000000000
token_nameName of the token.ETH
token_symbolSymbol of the token.ETH
token_idToken ID of a ERC721 token or ERC1155 token.
raw_balanceRaw balance amount of the token (not divided by the number of decimals)216,765,847,229,634
raw_balance_strRaw balance amount of the token (not divided by the number of decimals) in string.216765847229634
balanceraw_balance divided by the number of decimals of this token. This value will be the same as raw_balance for erc721 and erc1155 tokens.0.0002167658472
balance_strBalance of token normalized and in string format.0.0002167658472
usd_balance_currentUSD balance of token at the current timestamp.0.308804626
usd_balance_at_block_timestampUSD balance of token at the timestamp of the last activity that resulted in balance change.0.2800939895
usd_exchange_rate_currentUSD exchange rate of token at the current timestamp.1,424.60
usd_exchange_rate_at_block_timestampUSD exchange rate of token at the timestamp of the last activity that resulted in balance update.1,292.15
transaction_hashThe transaction hash that resulted in the balance update.0xb2bf75bdb376ab2c59fdfed688355bc4b3b20d2e71d3ec6ff8e3a6b47f3894dc
last_activity_block_timestampThe last timestamp of the block that that resulted in the balance update.2022-12-05 03:58:11
last_activity_block_numberThe last block number that resulted in the balance update.16,116,061
last_activity_block_hashThe block hash of the last activity that resulted in this balance.0x49ae37a2a5feb07d3f237dbfe4af59abb3b9ef19e3cd47ef083f1d7e45a2e616
_updated_at__usd_exchange_rate_currentTimestamp of the current USD exchange.2023-03-10 22:00:00
unique_idUnique ID of the balance.block-16116061_address-0x66a84d487780c088d862971045d84b02d9b25aab_eth
_updated_atTimestamp of the balance update.2023-03-10 10:18:07