instrument_store
InstrumentStore: in-memory registry of financial instruments.
Classes:
-
InstrumentStore–Stores instruments indexed by id and by type for O(1) / O(k) access.
InstrumentStore
InstrumentStore()
Stores instruments indexed by id and by type for O(1) / O(k) access.
Methods:
-
add–Register an instrument. Overwrites any existing entry with the same id.
-
all–Return all registered instruments.
-
by_type–Return all instruments of instrument_type (empty list if none).
-
get–Return the instrument for instrument_id; raise KeyError if absent.
add
add(instrument: Instrument) -> None
Register an instrument. Overwrites any existing entry with the same id.
by_type
by_type(
instrument_type: InstrumentType,
) -> list[Instrument]
Return all instruments of instrument_type (empty list if none).
get
get(instrument_id: str) -> Instrument
Return the instrument for instrument_id; raise KeyError if absent.