Skip to content

registry

Registry for financial instrument types to support deserialization.

Classes:

CategoryRegistry

Registry that checks whether an instrument belongs to a category by type.

Methods:

  • has_instrument

    Return True if instrument is an instance of a registered type.

  • register

    Register a new instrument type in this category.

has_instrument classmethod

has_instrument(instrument: Instrument) -> bool

Return True if instrument is an instance of a registered type.

register classmethod

register(instrument_type: type) -> None

Register a new instrument type in this category.

CorporateInstrumentRegistry

Bases: CategoryRegistry

Registry for corporate instrument types.

Methods:

  • has_instrument

    Return True if instrument is an instance of a registered type.

  • register

    Register a new instrument type in this category.

has_instrument classmethod

has_instrument(instrument: Instrument) -> bool

Return True if instrument is an instance of a registered type.

register classmethod

register(instrument_type: type) -> None

Register a new instrument type in this category.

InstrumentRegistry

InstrumentRegistry()

Registry mapping type identifiers to instrument classes or factory callables.

Allows decoupled deserialization: callers register concrete instrument types by a string key, then create instances by key without hard-coded imports.

Methods:

  • create

    Create an instrument instance for the given type identifier.

  • register

    Register an instrument class or factory under the given type identifier.

create

create(type_id: str, **kwargs: object) -> Instrument

Create an instrument instance for the given type identifier.

Parameters:

  • type_id

    (str) –

    The string key previously registered via :meth:register.

  • **kwargs

    (object, default: {} ) –

    Keyword arguments forwarded to the instrument constructor.

Returns:

  • Instrument

    A new instance of the registered instrument class.

Raises:

  • KeyError

    If type_id has not been registered.

register

register(
    type_id: str,
    cls: type[Instrument] | Callable[..., Instrument],
) -> None

Register an instrument class or factory under the given type identifier.

Parameters:

  • type_id

    (str) –

    A unique string key for the instrument type.

  • cls

    (type[Instrument] | Callable[..., Instrument]) –

    The concrete instrument class or a factory callable.

LoanInstrumentRegistry

Bases: CategoryRegistry

Registry for loan instrument types.

Methods:

  • has_instrument

    Return True if instrument is an instance of a registered type.

  • register

    Register a new instrument type in this category.

has_instrument classmethod

has_instrument(instrument: Instrument) -> bool

Return True if instrument is an instance of a registered type.

register classmethod

register(instrument_type: type) -> None

Register a new instrument type in this category.

MDBInstrumentRegistry

Bases: CategoryRegistry

Registry for MDB instrument types.

Methods:

  • has_instrument

    Return True if instrument is an instance of a registered type.

  • register

    Register a new instrument type in this category.

has_instrument classmethod

has_instrument(instrument: Instrument) -> bool

Return True if instrument is an instance of a registered type.

register classmethod

register(instrument_type: type) -> None

Register a new instrument type in this category.

MortgageInstrumentRegistry

Bases: CategoryRegistry

Registry for mortgage instrument types.

Methods:

  • has_instrument

    Return True if instrument is an instance of a registered type.

  • register

    Register a new instrument type in this category.

has_instrument classmethod

has_instrument(instrument: Instrument) -> bool

Return True if instrument is an instance of a registered type.

register classmethod

register(instrument_type: type) -> None

Register a new instrument type in this category.

OffBalanceSheetInstrumentRegistry

Bases: CategoryRegistry

Registry for off-balance-sheet instrument types.

Methods:

  • has_instrument

    Return True if instrument is an instance of a registered type.

  • register

    Register a new instrument type in this category.

has_instrument classmethod

has_instrument(instrument: Instrument) -> bool

Return True if instrument is an instance of a registered type.

register classmethod

register(instrument_type: type) -> None

Register a new instrument type in this category.

PSEInstrumentRegistry

Bases: CategoryRegistry

Registry for PSE instrument types.

Methods:

  • has_instrument

    Return True if instrument is an instance of a registered type.

  • register

    Register a new instrument type in this category.

has_instrument classmethod

has_instrument(instrument: Instrument) -> bool

Return True if instrument is an instance of a registered type.

register classmethod

register(instrument_type: type) -> None

Register a new instrument type in this category.

RealEstateInstrumentRegistry

Bases: CategoryRegistry

Registry for real estate instrument types.

Methods:

  • has_instrument

    Return True if instrument is an instance of a registered type.

  • register

    Register a new instrument type in this category.

has_instrument classmethod

has_instrument(instrument: Instrument) -> bool

Return True if instrument is an instance of a registered type.

register classmethod

register(instrument_type: type) -> None

Register a new instrument type in this category.

RetailInstrumentRegistry

Bases: CategoryRegistry

Registry for retail instrument types.

Methods:

  • has_instrument

    Return True if instrument is an instance of a registered type.

  • register

    Register a new instrument type in this category.

has_instrument classmethod

has_instrument(instrument: Instrument) -> bool

Return True if instrument is an instance of a registered type.

register classmethod

register(instrument_type: type) -> None

Register a new instrument type in this category.

TreasuryInstrumentRegistry

Bases: CategoryRegistry

Registry for treasury instrument types.

Methods:

  • has_instrument

    Return True if instrument is an instance of a registered type.

  • register

    Register a new instrument type in this category.

has_instrument classmethod

has_instrument(instrument: Instrument) -> bool

Return True if instrument is an instance of a registered type.

register classmethod

register(instrument_type: type) -> None

Register a new instrument type in this category.