Skip to content

bank_book_controller

Controller for managing bank book tree widgets.

Classes:

BankBookController

BankBookController(
    bank_book: BookView,
    tree: QTreeView,
    model: BankBookModel,
    inspector_ctrl: InspectorController,
    event_bus: EventBus,
    book_type: BookType,
    position_store: PositionStore,
)

Bases: BRMSController

Controller for managing a single book tree (banking or trading).

Each tree has two top-level nodes: Assets (row 0) and Liabilities (row 1). Instruments are grouped by MeasurementBasis under the appropriate node.

Methods:

add_instrument

add_instrument(
    instrument: Instrument,
    position: PositionSide | None = None,
    initial_value: float | None = None,
    measurement_basis: MeasurementBasis | None = None,
) -> None

Add an instrument under the appropriate class group node.

connect_signals

connect_signals() -> None

Connect signals to their respective slots.

disconnect_signals

disconnect_signals() -> None

Disconnect signals to prevent stale references on reload.

remove_instrument

remove_instrument(
    instrument: Instrument,
    position: PositionSide | None = None,
) -> None

Remove an instrument from the tree model.

reset

reset() -> None

Clear all instrument children from Assets and Liabilities nodes.

update_instrument

update_instrument(
    instrument: Instrument,
    position: PositionSide | None = None,
) -> None

Update an instrument's display in the tree model.

update_instrument_value

update_instrument_value(
    instrument_id: str, value: float
) -> None

Update the displayed value for an instrument by its ID.

BankingBookController

BankingBookController(
    bank_book: BookView,
    tree: QTreeView,
    model: BankBookModel,
    inspector_ctrl: InspectorController,
    event_bus: EventBus,
    book_type: BookType,
    position_store: PositionStore,
)

Bases: BankBookController

Controller for banking book.

Methods:

add_instrument

add_instrument(
    instrument: Instrument,
    position: PositionSide | None = None,
    initial_value: float | None = None,
    measurement_basis: MeasurementBasis | None = None,
) -> None

Add an instrument to the tree model.

connect_signals

connect_signals() -> None

Connect signals to their respective slots.

disconnect_signals

disconnect_signals() -> None

Disconnect signals to prevent stale references on reload.

remove_instrument

remove_instrument(
    instrument: Instrument,
    position: PositionSide | None = None,
) -> None

Remove an instrument from the tree model.

reset

reset() -> None

Clear all instrument children from Assets and Liabilities nodes.

update_instrument

update_instrument(
    instrument: Instrument,
    position: PositionSide | None = None,
) -> None

Update an instrument's display in the tree model.

update_instrument_value

update_instrument_value(
    instrument_id: str, value: float
) -> None

Update the displayed value for an instrument by its ID.

TradingBookController

TradingBookController(
    bank_book: BookView,
    tree: QTreeView,
    model: BankBookModel,
    inspector_ctrl: InspectorController,
    event_bus: EventBus,
    book_type: BookType,
    position_store: PositionStore,
)

Bases: BankBookController

Controller for trading book.

Methods:

add_instrument

add_instrument(
    instrument: Instrument,
    position: PositionSide | None = None,
    initial_value: float | None = None,
    measurement_basis: MeasurementBasis | None = None,
) -> None

Add an instrument under the appropriate class group node.

connect_signals

connect_signals() -> None

Connect signals to their respective slots.

disconnect_signals

disconnect_signals() -> None

Disconnect signals to prevent stale references on reload.

remove_instrument

remove_instrument(
    instrument: Instrument,
    position: PositionSide | None = None,
) -> None

Remove an instrument from the tree model.

reset

reset() -> None

Clear all instrument children from Assets and Liabilities nodes.

update_instrument

update_instrument(
    instrument: Instrument,
    position: PositionSide | None = None,
) -> None

Update an instrument's display in the tree model.

update_instrument_value

update_instrument_value(
    instrument_id: str, value: float
) -> None

Update the displayed value for an instrument by its ID.