run_daily_scan

Documentation for eth_defi.lighter.daily_metrics.run_daily_scan function.

run_daily_scan(session, db_path=PosixPath('/home/runner/.tradingstrategy/vaults/lighter-pools.duckdb'), min_tvl=1000, max_pools=200, max_workers=16, cutoff_date=None, timeout=30.0, pool_indices=None)

Run the daily Lighter pool metrics scan.

  1. Bulk-fetches all pools from publicPoolsMetadata

  2. Filters by TVL and pool limit (or by explicit index list)

  3. Fetches per-pool details and share price history in parallel

  4. Stores everything in DuckDB

Parameters
  • session (eth_defi.lighter.session.LighterSession) – HTTP session with rate limiting.

  • db_path (pathlib.Path) – Path to the DuckDB database file.

  • min_tvl (float) – Minimum TVL in USDC to include a pool. Ignored when pool_indices is provided.

  • max_pools (int) – Maximum number of pools to process (sorted by TVL descending). Ignored when pool_indices is provided.

  • max_workers (int) – Number of parallel workers for fetching pool details.

  • cutoff_date (Optional[datetime.date]) – If provided, only store price data up to this date. Used for incremental scanning / testing.

  • timeout (float) – HTTP request timeout.

  • pool_indices (Optional[list[int]]) – If provided, only scan these specific pool account indices. Overrides min_tvl and max_pools filters.

Returns

The metrics database instance.

Return type

eth_defi.lighter.daily_metrics.LighterDailyMetricsDatabase