event_reader.multicall_timestamp

Documentation for eth_defi.event_reader.multicall_timestamp Python module.

Read timestamps of blocks using multiprocess.

Functions

fetch_block_timestamps_multiprocess(...[, ...])

Extract timestamps using fast multiprocessing.

fetch_block_timestamps_multiprocess_auto_backend(...)

Fetch block timestamps, choose backend.

fetch_block_timestamps_multiprocess(chain_id, web3factory, start_block, end_block, step, display_progress=True, max_workers=8, timeout=120, cache_path=PosixPath('/home/runner/.tradingstrategy/block-timestamp'), checkpoint_freq=20000)

Extract timestamps using fast multiprocessing.

  • Subprocess entrypoint

  • This is called by a joblib.Parallel

  • The subprocess is recycled between different batch jobs

  • We cache reader Web3 connections between batch jobs

  • joblib never shuts down this process

Note

Because this method aggressively uses step to skip blocks, it results to non-reuseable timestamp cache (only valid for one scan and subsequent scans of the same task).

:param cache_path

Cache timestamps across runs and commands.

Set to None to disable, or remove the file. .

Parameters
Return type

eth_defi.event_reader.timestamp_cache.BlockTimestampSlicer

fetch_block_timestamps_multiprocess_auto_backend(chain_id, web3factory, start_block, end_block, step, display_progress=True, max_workers=8, timeout=120, cache_path=PosixPath('/home/runner/.tradingstrategy/block-timestamp'), checkpoint_freq=20000, hypersync_client=None)

Fetch block timestamps, choose backend.

  • If Hypersync is available, use the optimised code path

For arguments see fetch_block_timestamps_multiprocess().

Parameters
Returns

Pandas series block number (int) -> block timestamp (datetime)

Return type

eth_defi.event_reader.timestamp_cache.BlockTimestampSlicer