Skip to content

Commit

Permalink
fix: Add cashflow property to PortfolioHistory model (#553)
Browse files Browse the repository at this point in the history
The get_portfolio_history API returns an optional cashflow property, which is a mapping of activity type to cash flow amounts.
  • Loading branch information
fumoboy007 authored Jan 20, 2025
1 parent 88221cb commit 18e2403
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions alpaca/trading/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ class PortfolioHistory(BaseModel):
profit_loss_pct (List[Optional[float]]): Profit/loss in percentage from the base value.
base_value (float): Basis in dollar of the profit loss calculation.
timeframe (str): Time window size of each data element.
cashflow (Dict[ActivityType, List[float]]): Cash flow amounts per activity type, if any.
"""

timestamp: List[int]
Expand All @@ -302,6 +303,7 @@ class PortfolioHistory(BaseModel):
profit_loss_pct: List[Optional[float]]
base_value: float
timeframe: str
cashflow: Dict[ActivityType, List[float]] = {}


class Watchlist(ModelWithID):
Expand Down

0 comments on commit 18e2403

Please sign in to comment.