Skip to content

market_data

Market data store and zero-copy market state view.

Classes:

  • MarketDataStore

    Owns all market data as date-indexed DataFrames. Single source of truth.

  • MarketState

    Zero-copy view into MarketDataStore for a specific date.

MarketDataStore

MarketDataStore()

Owns all market data as date-indexed DataFrames. Single source of truth.

Methods:

  • add_frame

    Register a date-indexed DataFrame under the given name.

  • available_dates

    Return sorted list of dates present in all registered frames.

  • frame_names

    Names of all registered frames.

  • get_frame

    Return the raw DataFrame for the given name.

  • get_state

    Return a zero-copy MarketState view for the given date.

  • get_state_or_none

    Return a MarketState for date, or None if data is missing.

  • has_data

    Return True if all registered frames have data for date.

  • has_frame

    Return True if a frame with the given name is registered.

add_frame

add_frame(name: str, df: DataFrame) -> None

Register a date-indexed DataFrame under the given name.

available_dates

available_dates() -> list[date]

Return sorted list of dates present in all registered frames.

frame_names

frame_names() -> set[str]

Names of all registered frames.

get_frame

get_frame(name: str) -> DataFrame

Return the raw DataFrame for the given name.

get_state

get_state(date: date) -> MarketState

Return a zero-copy MarketState view for the given date.

Raises ScenarioNotAvailableError if any registered frame lacks data for that date.

get_state_or_none

get_state_or_none(date: date) -> MarketState | None

Return a MarketState for date, or None if data is missing.

has_data

has_data(date: date) -> bool

Return True if all registered frames have data for date.

has_frame

has_frame(name: str) -> bool

Return True if a frame with the given name is registered.

MarketState

MarketState(date: date, store: MarketDataStore)

Zero-copy view into MarketDataStore for a specific date.

Methods:

  • get

    Return a row from the named frame for this state's date.

Attributes:

  • benchmarks (Series) –

    Benchmark rates for this date (e.g. DPRIME). Values in percent as stored.

  • date (date) –

    The date this state represents.

  • equity_prices (Series) –

    Equity price data as a Series (view, not copy).

  • fx_rates (Series) –

    FX rate data as a Series (view, not copy).

  • yields (Series) –

    Yield curve data as a Series (view, not copy).

benchmarks property

benchmarks: Series

Benchmark rates for this date (e.g. DPRIME). Values in percent as stored.

date property

date: date

The date this state represents.

equity_prices property

equity_prices: Series

Equity price data as a Series (view, not copy).

fx_rates property

fx_rates: Series

FX rate data as a Series (view, not copy).

yields property

yields: Series

Yield curve data as a Series (view, not copy).

get

get(frame_name: str) -> Series

Return a row from the named frame for this state's date.