portfolio_toolkit.utils.period.get_last_months module
- portfolio_toolkit.utils.period.get_last_months.get_last_months(n=4) List[Period] [source]
Returns the last n completed months as Period objects (excluding current month).
For n=4 in July 2025, returns: [Period(“March 2025”, date(2025, 3, 1), date(2025, 3, 31)),
Period(“April 2025”, date(2025, 4, 1), date(2025, 4, 30)), Period(“May 2025”, date(2025, 5, 1), date(2025, 5, 31)), Period(“June 2025”, date(2025, 6, 1), date(2025, 6, 30))]