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: DataCore

Data 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

timestamp

numpy.int64

Timestamp for the snapshot of the balance

date

datetime.datetime

Date for the timestamp

block_number

int

Number of the block

address

str

Address for the balance

balance

numpy.float64

Balance of an address at the time