Skip to content

utils

Module for utility functions and classes.

Classes:

  • Observable

    Base class for observable components.

  • Observer

    Base class for observers.

Functions:

Observable

Observable()

Base class for observable components.

Methods:

add_observer

add_observer(observer: Observer) -> None

Add an observer to the list of observers.

notify_observers

notify_observers() -> None

Notify all observers about a change.

remove_observer

remove_observer(observer: Observer) -> None

Remove an observer from the list of observers.

Observer

Bases: ABC

Base class for observers.

Methods:

  • update

    Update when a observable notifies of a change.

update abstractmethod

update(observable: Observable) -> None

Update when a observable notifies of a change.

pydate_to_qdate

pydate_to_qdate(date: date) -> QDate

Convert a Python date object to a QDate object.

Parameters:

  • date

    (date) –

    The Python date object to be converted.

Returns:

  • QDate ( QDate ) –

    The corresponding QDate object.

pydate_to_qldate

pydate_to_qldate(date: date) -> Date

Convert a Python date object to a QuantLib date object.

Parameters:

  • date

    (date) –

    The Python date object to be converted.

Returns:

  • Date

    ql.Date: The corresponding QuantLib date object.

qdate_to_qldate

qdate_to_qldate(date: QDate) -> Date

Convert a QDate object to a ql.Date object.

Parameters:

  • date

    (QDate) –

    The QDate object to be converted.

Returns:

  • Date

    ql.Date: The converted ql.Date object.

qldate_to_pydate

qldate_to_pydate(date: Date) -> date

Convert a QuantLib date to a Python date.

Parameters:

  • date

    (Date) –

    The QuantLib date to be converted.

Returns:

  • date

    datetime.date: The equivalent Python date.

qldate_to_string

qldate_to_string(date: Date) -> str

Convert a QuantLib date to a string.

Parameters:

  • date

    (Date) –

    The QuantLib date to be converted.

Returns:

  • str

    "YYYY/MM/DD"