tokenised_fund.spiko.backfill
Documentation for eth_defi.tokenised_fund.spiko.backfill Python module.
Backfill one reviewed Spiko product’s metadata and NAV history.
This generated migration is address-scoped: it merges the selected product’s discovery row, preserves the existing chain discovery watermark and retains every unrelated reader-state, raw-Parquet and cleaned-Parquet entry. The supported daily NAV history starts with Spiko’s official Oracle deployment.
Run with source .local-test.env && PROTOCOLS=spiko poetry run python scripts/backfill-tokenised-funds.py.
Set SPIKO_PRODUCT=EUTBL to backfill EUTBL on Arbitrum; the default is USTBL
on Ethereum. Set DRY_RUN=true to inspect the plan first. START_BLOCK, END_BLOCK,
MAX_WORKERS, VAULT_DB_PATH, UNCLEANED_PRICE_DATABASE,
CLEANED_PRICE_DATABASE and READER_STATE_DATABASE are optional overrides.
Functions
|
Create the selected product's hardcoded discovery record. |
|
Run the selected address-scoped Spiko migration. |
|
Read an optional boolean environment variable. |
|
Read a path override without changing production defaults. |
|
Load trusted persisted reader state when available. |
Require daily sampling for the daily reconciled Spiko NAV. |
|
Select the reviewed Spiko product requested for this migration. |
|
|
Select the first block with the selected product's official NAV oracle. |
|
Atomically write merged reader state. |
- parse_bool_env(name, *, default=False)
Read an optional boolean environment variable.
- parse_path_env(name, default)
Read a path override without changing production defaults.
- Parameters
name (str) – Environment variable name.
default (pathlib.Path) – Default scanner path.
- Returns
Expanded configured path.
- Return type
- resolve_frequency()
Require daily sampling for the daily reconciled Spiko NAV.
- Returns
Daily scanner frequency.
- Raises
ValueError – If a different frequency was requested.
- Return type
Literal[‘1h’, ‘1d’]
- resolve_product()
Select the reviewed Spiko product requested for this migration.
- Returns
Selected reviewed Spiko product.
- Raises
ValueError – If
SPIKO_PRODUCTdoes not name a reviewed product.- Return type
- resolve_start_block(product=SpikoProduct(chain_id=1, token='0xe4880249745eac5f1ed9d8f7df844792d560e750', price_oracle='0x021289588cd81dc1ac87ea91e91607eef68303f5', first_seen_at_block=19690265, first_seen_at=datetime.datetime(2024, 4, 19, 15, 6, 11), oracle_first_seen_at_block=19690267, symbol='USTBL', denomination_symbol='USD', description="Tokenised share in Spiko's U.S. Treasury-bill money-market fund", short_description='U.S. Treasury-bill money-market strategy', management_fee=0.0025, product_url='https://www.spiko.io/spiko-treasury-bills-dollar', usd_price_oracle=None))
Select the first block with the selected product’s official NAV oracle.
- Parameters
product (eth_defi.tokenised_fund.spiko.constants.SpikoProduct) – Reviewed Spiko product being migrated.
- Returns
Explicit override or the Oracle deployment block.
- Return type
- create_spiko_detection(product=SpikoProduct(chain_id=1, token='0xe4880249745eac5f1ed9d8f7df844792d560e750', price_oracle='0x021289588cd81dc1ac87ea91e91607eef68303f5', first_seen_at_block=19690265, first_seen_at=datetime.datetime(2024, 4, 19, 15, 6, 11), oracle_first_seen_at_block=19690267, symbol='USTBL', denomination_symbol='USD', description="Tokenised share in Spiko's U.S. Treasury-bill money-market fund", short_description='U.S. Treasury-bill money-market strategy', management_fee=0.0025, product_url='https://www.spiko.io/spiko-treasury-bills-dollar', usd_price_oracle=None))
Create the selected product’s hardcoded discovery record.
- Parameters
product (eth_defi.tokenised_fund.spiko.constants.SpikoProduct) – Reviewed Spiko product being migrated.
- Returns
Product-specific classification record.
- Return type
- read_reader_states(path)
Load trusted persisted reader state when available.
- Parameters
path (pathlib.Path) – Shared reader-state pickle file.
- Returns
Existing reader states, or an empty mapping.
- Return type
- write_reader_states(path, states)
Atomically write merged reader state.
- Parameters
path (pathlib.Path) – Shared reader-state pickle file.
states (dict[eth_defi.vault.base.VaultSpec, dict]) – Merged state mapping.
- Return type
None
- main()
Run the selected address-scoped Spiko migration.
- Return type
None