portfolio_toolkit.utils.period.period module

class portfolio_toolkit.utils.period.period.Period(label: str, start_date: date, end_date: date)[source]

Bases: object

Represents a time period with a label and start/end dates.

label

Human-readable name for the period (e.g., “Q3 2025”, “July 2025”)

Type:

str

start_date

Start date of the period

Type:

date

end_date

End date of the period

Type:

date

Example

quarter = Period(“Q3 2025”, date(2025, 7, 1), date(2025, 9, 30)) month = Period(“July 2025”, date(2025, 7, 1), date(2025, 7, 31))

label: str
start_date: date
end_date: date
__post_init__()[source]

Validate that end_date is not before start_date.

__str__() str[source]

String representation of the period.

__init__(label: str, start_date: date, end_date: date) None