fetch_block_timestamps_using_hypersync_cached_async

Documentation for eth_defi.hypersync.hypersync_timestamp.fetch_block_timestamps_using_hypersync_cached_async function.

async fetch_block_timestamps_using_hypersync_cached_async(client, chain_id, start_block, end_block, cache_path=PosixPath('/home/runner/.tradingstrategy/block-timestamp'), display_progress=True, chunk_size=100000)

Quickly get block timestamps using Hypersync API and a local cache file.

  • Ultra fast, used optimised Hypersync streaming and DuckDB local cache.

  • Large ranges are split into chunks of chunk_size blocks so that each chunk opens a separate Hypersync stream() call. This keeps individual requests small, lets the Python-side rate limiter pace them, and — crucially — saves progress after each chunk so that a 429 failure only loses the current chunk, not all prior work.

Parameters
  • chunk_size (int) – Maximum number of blocks per Hypersync streaming request. Defaults to 100 000 (~2 days on Polygon, ~3 days on Binance).

  • client (hypersync.HypersyncClient) –

  • chain_id (int) –

  • start_block (int) –

  • end_block (int) –

  • display_progress (bool) –

Returns

Block number -> datetime mapping

Return type

eth_defi.event_reader.timestamp_cache.BlockTimestampSlicer