portfolio_toolkit.portfolio.time_series.utils module

portfolio_toolkit.portfolio.time_series.utils.get_ticker_holding_intervals(assets, ticker)[source]

Returns the date intervals where a specific ticker was held in the portfolio.

Parameters:

ticker (str) – The ticker symbol to analyze.

Returns:

List of tuples with (start_date, end_date) intervals where the ticker was held.

Returns empty list if ticker was never held or is not found.

Return type:

list

Example

[(‘2025-06-01’, ‘2025-06-10’), (‘2025-06-20’, ‘2025-07-03’)]

portfolio_toolkit.portfolio.time_series.utils.create_date_series_from_intervals(intervals)[source]

Creates a pandas Series with all dates from multiple intervals.

Parameters:

intervals (list) – List of tuples with (start_date, end_date)

Returns:

Series with all dates from the intervals

Return type:

pd.DatetimeIndex