tokenised_fund.usyc.backfill
Documentation for eth_defi.tokenised_fund.usyc.backfill Python module.
Backfill Circle USYC metadata and oracle-backed price history.
This targeted migration touches only the Ethereum USYC identifier. It preserves unrelated vault metadata, reader-state entries and raw/cleaned Parquet history rows. USYC price scans begin at the current official oracle deployment because the prior token deployment has no compatible oracle history.
Run with:
source .local-test.env && PROTOCOLS=usyc poetry run python scripts/backfill-tokenised-funds.py
Set DRY_RUN=true to validate the plan without writes. Optional overrides:
START_BLOCK, END_BLOCK, FREQUENCY (1d only), MAX_WORKERS,
VAULT_DB_PATH, UNCLEANED_PRICE_DATABASE, CLEANED_PRICE_DATABASE
and READER_STATE_DATABASE.
Functions
Create the synthetic discovery record for USYC. |
|
|
Run the USYC-only historical migration. |
|
Parse a boolean environment variable. |
|
Read an optional path override. |
|
Read trusted local reader state when it exists. |
Require daily samples because USYC publishes one reconciled daily NAV. |
|
Select the first block with the official current USYC oracle. |
|
|
Atomically persist merged reader state. |
- parse_bool_env(name, *, default=False)
Parse a boolean environment variable.
- parse_path_env(name, default)
Read an optional path override.
- Parameters
name (str) – Environment variable name.
default (pathlib.Path) – Default production location.
- Returns
Selected expanded path.
- Return type
- resolve_frequency()
Require daily samples because USYC publishes one reconciled daily NAV.
- Returns
Daily scanner frequency.
- Raises
ValueError – If a non-daily frequency is requested.
- Return type
Literal[‘1h’, ‘1d’]
- resolve_start_block()
Select the first block with the official current USYC oracle.
- Returns
Explicit override or the oracle deployment block.
- Return type
- create_usyc_detection()
Create the synthetic discovery record for USYC.
- Returns
USYC classification record.
- Return type
- read_reader_states(path)
Read trusted local reader state when it exists.
- Parameters
path (pathlib.Path) – Shared reader-state pickle path.
- Returns
Existing states or an empty mapping.
- Return type
- write_reader_states(path, states)
Atomically persist merged reader state.
- Parameters
path (pathlib.Path) – Shared reader-state pickle path.
states (dict[eth_defi.vault.base.VaultSpec, dict]) – Merged reader states.
- Return type
None
- main()
Run the USYC-only historical migration.
- Return type
None