abaquant.marketdata.universe_history

Import path: abaquant.marketdata.universe_history

Domain: Provider-neutral market-data facades, normalized records, caching, and analytics.

Purpose

Normalized historical price and return panels for ticker universes.

When to use it

Use this package to retrieve or inject quotes, price history, option chains, and financial statements while preserving a stable analytical interface.

Public objects

  • class: UniverseHistory — Lazy historical-price and return retrieval namespace for a universe. * UniverseHistory.prices — Return the normalized price data required by this interface. * UniverseHistory.returns — Compute periodic returns from the normalized price panel.

  • function: normalize_price_panel — Compute the result defined by ‘’normalize_price_panel’’ under this module’s documented convention.

Detailed reference

Normalized historical price and return panels for ticker universes.

Purpose

The module obtains batched provider histories, extracts close-like fields, aligns trading dates, and converts price panels to simple or log returns.

Conventions

Inner alignment keeps only dates with complete data for every asset; outer alignment preserves missing values. No forward filling or interpolation is performed.

References

[ 1 ] Markowitz, H. (1952), “Portfolio Selection”.

class abaquant.marketdata.universe_history.UniverseHistory(universe)

Bases: object

Lazy historical-price and return retrieval namespace for a universe.

Parameters:

universe (MarketUniverse)

universe

Universe that supplies symbol ordering, provider access, and the in-memory normalized-price cache.

Type:

MarketUniverse

Notes

Retrieval requests are lazy. Construction does not invoke the configured provider; prices and returns do so only when their cache key is absent.

prices(*, start=None, end=None, period='1y', interval='1d', auto_adjust=True, alignment='inner')

Return the normalized price data required by this interface.

Parameters:
  • start (str | date | None, default=None) – Optional inclusive history start date.

  • end (str | date | None, default=None) – Optional exclusive or provider-defined history end date.

  • period (str | None, default='1y') – Provider history period label, such as "1y", when explicit dates are not supplied.

  • interval (str, default='1d') – Provider sampling interval label, such as "1d".

  • auto_adjust (bool, default=True) – Whether provider-adjusted price history is requested.

  • alignment (Alignment, default='inner') – Date-alignment rule: "inner" keeps complete common dates and "outer" preserves the date union.

Returns:

Tabular result with the index, column schema, units, and missing-value treatment defined by the module convention.

Return type:

pandas.DataFrame

Notes

The applied layer normalizes provider data but cannot guarantee provider completeness, timeliness, or accuracy.

returns(*, kind='simple', start=None, end=None, period='1y', interval='1d', auto_adjust=True, alignment='inner')

Compute periodic returns from the normalized price panel.

Parameters:
  • kind (ReturnKind, default='simple') – Return convention: "simple" for arithmetic returns or "log" for logarithmic returns.

  • start (str | date | None, default=None) – Optional inclusive history start date.

  • end (str | date | None, default=None) – Optional exclusive or provider-defined history end date.

  • period (str | None, default='1y') – Provider history period label, such as "1y", when explicit dates are not supplied.

  • interval (str, default='1d') – Provider sampling interval label, such as "1d".

  • auto_adjust (bool, default=True) – Whether provider-adjusted price history is requested.

  • alignment (Alignment, default='inner') – Date-alignment rule: "inner" keeps complete common dates and "outer" preserves the date union.

Returns:

Tabular result with the index, column schema, units, and missing-value treatment defined by the module convention.

Return type:

pandas.DataFrame

Notes

This is an analytical in-sample calculation. It does not by itself model transaction costs, execution effects, taxes, or future return uncertainty. The applied layer normalizes provider data but cannot guarantee provider completeness, timeliness, or accuracy.

abaquant.marketdata.universe_history.normalize_price_panel(provider_price_panel, symbols, *, alignment='inner')

Compute the result defined by normalize_price_panel under this module’s documented convention.

Parameters:
  • provider_price_panel (pandas.DataFrame) – Raw batched provider output before field extraction and date alignment.

  • symbols (tuple[str, ...]) – Ticker symbols to normalize and include in the applied universe.

  • alignment (Alignment, default='inner') – Date-alignment rule: "inner" keeps complete common dates and "outer" preserves the date union.

Returns:

Tabular result with schema defined by the module-level convention.

Return type:

pd.DataFrame

Notes

The applied layer normalizes provider data but cannot guarantee provider completeness, timeliness, or accuracy.

abaquant.marketdata.universe_history.MarketUniverseHistory

alias of UniverseHistory