sf_quant.data.load_assets_by_date#
- sf_quant.data.load_assets_by_date(date_: date, in_universe: bool, columns: list[str]) DataFrame#
Load a Polars DataFrame of assets data for a single date.
Parameters#
- date_datetime.date
Date of the data frame.
- in_universebool
If
True, restrict to assets that are in the universe. IfFalse, include all assets.- columnslist of str
List of column names to include in the result.
Returns#
- polars.DataFrame
A DataFrame containing asset data on the specified date, filtered by universe membership if requested, with only the selected columns.
Examples#
>>> import sf_quant as sf >>> import datetime as dt >>> date_ = dt.date(2024, 1, 3) >>> columns = ["barrid", "date", "price"] >>> df = sf.data.load_assets_by_date( ... date_=date_, ... in_universe=True, ... columns=columns ... ) >>> df.head() shape: (5, 3) ┌────────────┬─────────┬───────┐ │ date ┆ barrid ┆ price │ │ --- ┆ --- ┆ --- │ │ date ┆ str ┆ f64 │ ╞════════════╪═════════╪═══════╡ │ 2024-01-03 ┆ USA06Z1 ┆ 7.775 │ │ 2024-01-03 ┆ USA0771 ┆ 10.23 │ │ 2024-01-03 ┆ USA0C11 ┆ 74.15 │ │ 2024-01-03 ┆ USA0SY1 ┆ 130.1 │ │ 2024-01-03 ┆ USA11I1 ┆ 43.55 │ └────────────┴─────────┴───────┘