Skip to content

Commit

Permalink
start and end
Browse files Browse the repository at this point in the history
  • Loading branch information
rwijtvliet committed Nov 5, 2024
1 parent 1b5e94a commit ff34f8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions portfolyo/core/pfline/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ def index(self) -> pd.DatetimeIndex:
"""Index of the data, containing the left-bound timestamps of the delivery periods."""
return self.df.index

@property
def start(self) -> pd.Timestamp:
"""Start (incl) of the portfolio line."""
return self.df.index[0]

@property
def end(self) -> pd.Timestamp:
"""End (excl) of the portfolio line."""
return tools.right.index(self.df.index)[-1]

@property
@abc.abstractmethod
def w(self) -> pd.Series:
Expand Down
2 changes: 1 addition & 1 deletion portfolyo/tools/right.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from . import freq as tools_freq


def stamp(ts: pd.Timestamp, freq: str = None) -> pd.Timestamp:
def stamp(ts: pd.Timestamp, freq: str) -> pd.Timestamp:
f"""Right-bound timestamp belonging to left-bound timestamp.
Parameters
Expand Down

0 comments on commit ff34f8a

Please sign in to comment.