tokenised_fund.asseto.registry
Documentation for eth_defi.tokenised_fund.asseto.registry Python module.
Build runtime Asseto adapter products from the persisted public registry.
The recurring scanner persists Asseto vault rows across process restarts, while the adapter needs an in-memory product record. This module rebuilds that runtime registry before a daily scan and registers newly published supported products from the same fresh API snapshot.
Functions
|
Create the minimal synthetic detection needed for metadata upserts. |
|
Create a synthetic discovery lead for one Asseto product. |
|
Create one adapter product from API identity and onchain discovery. |
|
Find the first token-code block for a newly registered product. |
|
Refresh Asseto metadata, register new products and rebuild adapters. |
|
Load historical quote-currency-per-USD rates for Asseto products. |
|
Resolve the accounting denomination from Asseto's public product data. |
Classes
Summary of runtime registry preparation for one scanner invocation. |
- class AssetoRegistryRefreshResult
Bases:
objectSummary of runtime registry preparation for one scanner invocation.
- Variables
status – Registry source status, either
freshorstale.runtime_product_count – Number of products installed for adapter construction.
registered_product_count – Number of newly persisted vault metadata records.
diagnostics – Non-fatal skipped-product and stale-source diagnostics.
available_specs – Persisted products with a runtime adapter installed for this cycle.
- available_specs: frozenset[eth_defi.vault.base.VaultSpec]
Persisted products with a runtime adapter installed for this cycle.
- __init__(status, runtime_product_count, registered_product_count, diagnostics, available_specs=frozenset({}))
- resolve_asseto_denomination_symbol(product)
Resolve the accounting denomination from Asseto’s public product data.
Asseto omits the symbol on its
stokenproducts even though their NAV series is USD-denominated. All other products need an explicit symbol so the scanner can safely select a conversion history.- Parameters
product (eth_defi.tokenised_fund.asseto.offchain_api.AssetoOffchainProduct) – Normalised product read from Asseto’s public registry.
- Returns
Upper-case accounting currency, or
Nonewhen it is not usable.- Return type
- load_usd_exchange_rates(database_path, denomination_symbols)
Load historical quote-currency-per-USD rates for Asseto products.
Asseto NAV values in non-USD currencies are divided by these rates before entering the shared USD history. The targeted backfill and daily scanner intentionally share this exact conversion rule.
- Parameters
database_path (pathlib.Path) – Currency API DuckDB produced by
scan-currencies.denomination_symbols (collections.abc.Iterable[Optional[str]]) – Accounting currencies requested by the selected products.
- Returns
Exchange-rate history keyed by upper-case currency symbol.
- Raises
RuntimeError – If required currency history is unavailable.
- Return type
- create_asseto_runtime_product(product, first_seen_at_block, first_seen_at, usd_exchange_rates=())
Create one adapter product from API identity and onchain discovery.
The scheduled and manual paths use this constructor so product identity, offchain NAV lookup and non-USD conversion state cannot diverge.
- Parameters
product (eth_defi.tokenised_fund.asseto.offchain_api.AssetoOffchainProduct) – Normalised public Asseto product entry.
first_seen_at_block (int) – First onchain block containing the token’s code.
first_seen_at (datetime.datetime) – Naive UTC token deployment timestamp.
usd_exchange_rates (tuple[tuple[int, decimal.Decimal], ...]) – Historical units of the denomination currency per USD, if required.
- Returns
Adapter-ready Asseto product record.
- Return type
- fetch_asseto_deployment_block(web3, address, end_block)
Find the first token-code block for a newly registered product.
The public registry has no deployment block, so a binary search over an archive-capable provider supplies the start boundary for history scans.
- Parameters
web3 (web3.main.Web3) – Archive-capable product-chain connection.
address (eth_typing.evm.HexAddress) – Asseto token contract address.
end_block (int) – Latest block at which the token must have deployed code.
- Returns
Earliest block containing token runtime code.
- Raises
ValueError – If the registry address has no code at
end_block.- Return type
- create_asseto_detection(product)
Create the minimal synthetic detection needed for metadata upserts.
Asseto products do not emit ERC-4626 discovery events, so their metadata read uses this equivalent persisted detection record.
- Parameters
product (eth_defi.tokenised_fund.asseto.constants.AssetoProduct) – Adapter-ready Asseto product record.
- Returns
Detection compatible with the shared vault metadata scanner.
- Return type
- create_asseto_lead(product)
Create a synthetic discovery lead for one Asseto product.
- Parameters
product (eth_defi.tokenised_fund.asseto.constants.AssetoProduct) – Fully resolved Asseto adapter product.
- Returns
Lead compatible with the persistent vault metadata database.
- Return type
- fetch_asseto_registry_preparation(*, vault_db_path, enabled_chain_ids, cache_path=PosixPath('/home/runner/.tradingstrategy/cache/asseto/registry-cache.json'), token_cache=None)
Refresh Asseto metadata, register new products and rebuild adapters.
Fresh API data may register products and update their metadata. Stale data is deliberately limited to rebuilding runtime entries for already-persisted Asseto rows, so an outage cannot write old API values into the vault database.
- Parameters
vault_db_path (pathlib.Path) – Persistent vault metadata database used by the recurring scanner.
enabled_chain_ids (frozenset[int]) – Chains available to the operator in this invocation.
cache_path (pathlib.Path) – Shared Asseto registry cache path.
token_cache (Optional[eth_defi.token.TokenDiskCache]) – Optional shared token cache for metadata reads.
- Returns
Preparation outcome and non-fatal product diagnostics.
- Return type
eth_defi.tokenised_fund.asseto.registry.AssetoRegistryRefreshResult