data.ethers
Module for fetching ETH balances for addresses.
Examples
from datetime import datetime
from web3cat.data import EtherData
dates = [datetime(2021, 6, 1), datetime(2021, 7, 1), datetime(2021, 8, 1), datetime(2021, 9, 1)]
addresses = ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "0xf977814e90da44bfa03b6295a0616a897441acec"]
ether_data = EtherData(min(dates), max(dates))
# Historical Ether balances for addresses
ether_data.balances(addresses, dates)
- class web3cat.data.ethers.EtherData(start: int | datetime.datetime, end: int | datetime.datetime, **kwargs)
Bases:
DataCoreData for ETH balances
- balances(addresses: List[str], timepoints: List[int | datetime.datetime]) DataFrame
Get ether balances.
- Parameters:
addresses – a list of addresses to fetch balances for
timepoints – a list of timepoints
- Returns:
A Dataframe with fields
Field
Type
Description
timestampTimestamp for the snapshot of the balance
dateDate for the timestamp
block_numberNumber of the block
addressAddress for the balance
balanceBalance of an address at the time