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_usyc_detection()

Create the synthetic discovery record for USYC.

main()

Run the USYC-only historical migration.

parse_bool_env(name, *[, default])

Parse a boolean environment variable.

parse_path_env(name, default)

Read an optional path override.

read_reader_states(path)

Read trusted local reader state when it exists.

resolve_frequency()

Require daily samples because USYC publishes one reconciled daily NAV.

resolve_start_block()

Select the first block with the official current USYC oracle.

write_reader_states(path, states)

Atomically persist merged reader state.

parse_bool_env(name, *, default=False)

Parse a boolean environment variable.

Parameters
  • name (str) – Variable name.

  • default (bool) – Value used when the variable is absent.

Returns

Parsed boolean value.

Return type

bool

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

pathlib.Path

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

int

create_usyc_detection()

Create the synthetic discovery record for USYC.

Returns

USYC classification record.

Return type

eth_defi.erc_4626.core.ERC4262VaultDetection

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

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

write_reader_states(path, states)

Atomically persist merged reader state.

Parameters
Return type

None

main()

Run the USYC-only historical migration.

Return type

None