portfolio_toolkit.utils.period.get_current_period module
- portfolio_toolkit.utils.period.get_current_period.get_current_period(period_type: str) Period [source]
Returns the current period as a Period object based on the specified type.
- Parameters:
period_type (str) – Type of period (‘year’, ‘quarter’, ‘month’, ‘week’)
- Returns:
Period object representing the current period
- Return type:
- Raises:
ValueError – If period_type is not supported
Example
current_week = get_current_period(‘week’) current_quarter = get_current_period(‘quarter’) current_year = get_current_period(‘year’)