scan_projects
Documentation for eth_defi.core3.scanner.scan_projects function.
- scan_projects(session, db_path=PosixPath('/home/runner/.tradingstrategy/vaults/core3/core3.duckdb'), fetch_sections=False, fetch_pol_history=True, fetch_category_history=True, fetch_index_pol=True, limit=None, max_workers=8, timeout=60.0)
Scan all Core3 projects and store snapshots in DuckDB.
This function:
Fetches the project list from
/v1/listto get all slugsFor each slug (parallelised with
joblib):Fetches
/v1/{slug}and inserts intoproject_snapshotsOptionally fetches PoL history and inserts into
pol_dailyOptionally fetches category history and inserts into
pol_category_dailyOptionally fetches section endpoints and inserts into
section_snapshots
Optionally fetches index-level PoL history
- Parameters
session (eth_defi.core3.session.Core3Session) – Core3 API session. Use
create_core3_session()to create one.db_path (pathlib.Path) – Path to the DuckDB database file.
fetch_sections (bool) – If
True, also fetch section detail endpoints (security, financial, etc.). This is slower (5 extra API calls per project).fetch_pol_history (bool) – If
True, fetch PoL daily history for each project.fetch_category_history (bool) – If
True, fetch category PoL breakdown history for each project.fetch_index_pol (bool) – If
True, fetch the aggregate index-level PoL history.limit (Optional[int]) – Limit the number of projects to scan. For testing only.
max_workers (int) – Maximum number of parallel workers for fetching project data.
timeout (float) – HTTP request timeout in seconds.
- Returns
Core3Databaseinstance with the newly inserted data. Caller must callclose()when done.- Return type