Skip to content

PortfolioState

QuantConnect.Securities.Positions.PortfolioState

Bases: Object

Snapshot of an algorithms portfolio state

time

time: datetime

Utc time this portfolio snapshot was taken

total_portfolio_value

total_portfolio_value: float

The current total portfolio value

total_margin_used

total_margin_used: float

The margin used

position_groups

position_groups: List[PositionGroupState]

The different positions groups

cash_book

cash_book: Dictionary[str, Cash]

Gets the cash book that keeps track of all currency holdings (only settled cash)

unsettled_cash_book

unsettled_cash_book: Dictionary[str, Cash]

Gets the cash book that keeps track of all currency holdings (only unsettled cash)

create

create(
    portfolio_manager: SecurityPortfolioManager,
    utc_now: Union[datetime, date],
    current_portfolio_value: float,
) -> PortfolioState

Helper method to create the portfolio state snapshot