read_multicall_historical
Documentation for eth_defi.event_reader.multicall_batcher.read_multicall_historical function.
- read_multicall_historical(chain_id, web3factory, calls, start_block, end_block, step, max_workers=8, timeout=1800, display_progress=True, progress_suffix=None, require_multicall_result=False, hypersync_client=None, timestamp_cache_file=PosixPath('/home/runner/.tradingstrategy/block-timestamp'), rpc_request_stats=None, greylist_batch_size=1, allow_greylist_unavailable=False, greylist=frozenset({}), batch_size=100)
Fetch stateless historical samples with process-local Multicall workers.
Each sampled block becomes an ordered joblib task. Connections are reused inside workers; timestamps can be supplied from the shared Hypersync cache to avoid one header RPC per task. Isolation follows the caller-supplied target list without altering the requested source block.
- Parameters
batch_size (int) – Positive regular encoded-subcall limit per physical request.
greylist (frozenset[eth_typing.evm.HexAddress]) – Caller-selected target addresses for this chain, matched case-insensitively. Defaults to empty: readers never import or select chain-specific policies.
greylist_batch_size (int) – Positive maximum encoded subcalls per supplied greylisted target request, default one. Normal targets retain standard batching. This counts subcalls rather than vaults and never combines different isolated targets.
allow_greylist_unavailable (bool) – Opt in to explicit unavailable results only when the consumer preserves old source observations. Defaults to strict transport errors. The vault price exporter opts in; arbitrary historical callers remain strict.
chain_id (int) – Which chain we are targeting with calls.
calls (Iterable[eth_defi.event_reader.multicall_batcher.EncodedCall]) – Encoded contract calls reused at each sampled block.
max_workers (int) – Maximum joblib process workers, default eight.
timestamp_cache_file (pathlib.Path) – Dense per-chain Hypersync timestamp cache folder.
rpc_request_stats (Optional[eth_defi.provider.rpcdb.RPCRequestStats]) – Optional accumulator for physical worker attempts.
web3factory (eth_defi.event_reader.web3factory.Web3Factory) – The connection factory for subprocesses
start_block (int) – Block range to scoop
end_block (int) – Block range to scoop
step (int) – How many blocks we iterate at once
timeout (float) – Joblib timeout to wait for a result from an individual task
progress_suffix (Optional[Callable]) – Allow caller to decorate the progress bar
require_multicall_result (bool) – Debug parameter to crash the reader if we start to get invalid replies from Multicall3 contract.
display_progress (Union[bool, str]) –
Whether to display progress bar or not.
Set to string to have a progress bar label.
hypersync_client (HypersyncClient | None) – Optional HyperSync client used to fetch the sampled block timestamps through the shared cache. This keeps timestamp reads out of the archive JSON-RPC workers.
- Returns
Combined subcall results in sampled block order.
- Return type
Iterator[eth_defi.event_reader.multicall_batcher.CombinedEncodedCallResult]