Skip to main content
data is a BarData object passed to handle_data, scheduled callbacks, and before_trading_start. It gives you current values and trailing history from the market data source and optional custom data sources. Ziplime data access is async and returns Polars data frames.

Current values

await data.current(assets, fields, data_source=None)

Read the latest available values at the current simulation timestamp.
For multiple assets:
The exact identifier columns depend on the loaded data source, but OHLCV fields are read by name.

Historical windows

await data.history(assets, bar_count, frequency=timedelta(days=1), fields=None, data_source=None)

Read a trailing window ending before the current bar.
The current implementation calls the data source with include_end_date=False, so history is best used for completed previous bars. If your signal needs the current bar too, read it separately with data.current(...).

Fields

Common market-data fields: Custom data bundles can expose additional fields. Pass the bundle name through data_source if you need a non-default source:

Working with Polars

Ziplime returns polars.DataFrame, so normal Polars operations apply.
For one asset and one field, the most common extraction is:

Data clock helpers

data.current_dt returns the current simulation datetime.
data.current_session returns the current trading session label.

Tradability checks

data.can_trade(assets) exists for Zipline compatibility and is intended to check asset liveness, exchange hours, restrictions, and available price data. For portable strategy code in the current Ziplime runtime, prefer checking the data you actually need before ordering: