VaultHistoricalReadMulticaller

Documentation for eth_defi.vault.historical.VaultHistoricalReadMulticaller Python class.

class VaultHistoricalReadMulticaller

Bases: object

Read historical data from multiple vaults using multicall and archive node polling.

Parameters

supported_quote_tokens – Allows us to validate vaults against list of supported tokens

Methods summary

__init__(web3factory[, ...])

param supported_quote_tokens

generate_vault_historical_calls(readers[, ...])

Generate multicalls for each vault to read its state at any block.

prepare_readers(vaults[, stateful, saved_states])

Create readrs for vaults.

read_historical(vaults, start_block, ...[, ...])

Create an iterable that extracts vault record from RPC.

save_reader_state()

Save the state of all readers.

validate_vaults(vaults)

Check that we can read these vaults.

__init__(web3factory, supported_quote_tokens=set[eth_defi.token.TokenDetails] | None, max_workers=8, token_cache=None, require_multicall_result=False, hypersync_client=None, timestamp_cache_file=PosixPath('/home/runner/.tradingstrategy/block-timestamp'))
Parameters
validate_vaults(vaults)

Check that we can read these vaults.

  • Validate that we know how to read vaults

Raises

VaultReadNotSupported – In the case we cannot read some of the vaults

Parameters

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

prepare_readers(vaults, stateful=False, saved_states=None)

Create readrs for vaults.

Parameters
Return type

dict[eth_typing.evm.HexAddress, eth_defi.vault.base.VaultHistoricalReader]

generate_vault_historical_calls(readers, display_progress=True)

Generate multicalls for each vault to read its state at any block.

Parameters
Return type

Iterable[tuple[eth_defi.event_reader.multicall_batcher.EncodedCall, eth_defi.event_reader.multicall_batcher.BatchCallState]]

read_historical(vaults, start_block, end_block, step, reader_func=<function read_multicall_historical>, saved_states=None)

Create an iterable that extracts vault record from RPC.

Parameters
Returns

Unordered results

Return type

Iterable[eth_defi.vault.base.VaultHistoricalRead]

save_reader_state()

Save the state of all readers.

Returns

Dictionary keyed by the vault spce

Return type

dict[eth_defi.vault.base.VaultSpec, dict]