scan_historical_prices_to_parquet

Documentation for eth_defi.vault.historical.scan_historical_prices_to_parquet function.

scan_historical_prices_to_parquet(output_fname, web3, web3factory, vaults, token_cache, start_block=None, end_block=None, step=None, chunk_size=1024, compression='zstd', max_workers=8, require_multicall_result=False, frequency='1d', reader_states=None, hypersync_client=None, timestamp_cache_file=PosixPath('/home/runner/.tradingstrategy/block-timestamp'))

Scan all historical vault share prices of vaults and save them in to Parquet file.

  • Write historical prices to a Parquet file

  • Multiprocess-boosted

  • The same Parquet file can contain data from multiple chains

Parameters
  • output_fname (pathlib.Path) –

    Path to a destination Parquet file.

    If the file exists, all entries for the current chain are deleted and rewritten.

  • web3 (web3.main.Web3) – Web3 connection

  • web3factory (eth_defi.event_reader.web3factory.Web3Factory) – Creation of connections in subprocess

  • vaults (list[eth_defi.vault.base.VaultBase]) –

    Vaults of which historical price we scan.

    All vaults must have their first_seen_at_block attribute set to increase scan performance.

  • start_block

    First block to scan.

    Leave empty to autodetect

  • end_block

    Last block to scan.

    Leave empty to autodetect.

  • step_duration

    What is the historical step size (1 day).

    Will be automatically attmpeted to map to a block time.

  • step – What is the step is in number of blocks.

  • chunk_size – How many rows to write to the Parquet file in one buffer.

  • max_workers – Number of subprocesses to use for multicall

  • hypersync_client – Speed up the discovery of timestamps

  • token_cache (eth_defi.token.TokenDiskCache) –

  • frequency (Literal['1d', '1h']) –

  • reader_states (dict[eth_defi.vault.base.VaultSpec, dict] | None) –

Returns

Scan report.

Return type

eth_defi.vault.historical.ParquetScanResult