event_reader.multicall_timestamp
Documentation for eth_defi.event_reader.multicall_timestamp Python module.
Read timestamps of blocks using multiprocess.
Functions
|
Extract timestamps using fast multiprocessing. |
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
Noneto disable, or remove the file. .
- Parameters
checkpoint_freq (int) – Block number frequency how often to save.
chain_id (int) –
web3factory (eth_defi.event_reader.web3factory.Web3Factory) –
start_block (int) –
end_block (int) –
step (int) –
cache_path (pathlib.Path | None) –
- 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
step (int) – Hypersync does not respect step but gets all blocks.
chain_id (int) –
web3factory (eth_defi.event_reader.web3factory.Web3Factory) –
start_block (int) –
end_block (int) –
cache_path (pathlib.Path | None) –
checkpoint_freq (int) –
hypersync_client (hypersync.HypersyncClient | None) –
- Returns
Pandas series block number (int) -> block timestamp (datetime)
- Return type
eth_defi.event_reader.timestamp_cache.BlockTimestampSlicer