Skip to content

PortfolioLooper

QuantConnect.Report.PortfolioLooper

Bases: Object, IDisposable

Runs LEAN to calculate the portfolio at a given time from Order objects. Generates and returns PointInTimePortfolio objects that represents the holdings and other miscellaneous metrics at a point in time by reprocessing the orders as they were filled.

algorithm

QCAlgorithm derived class that sets up internal data feeds for use with crypto and forex data, as well as managing the SecurityPortfolioManager

dispose

dispose() -> None

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

from_orders

from_orders(
    equity_curve: Any,
    orders: List[Order],
    algorithm_configuration: AlgorithmConfiguration = None,
    live_series: bool = False,
) -> Iterable[PointInTimePortfolio]

Gets the point in time portfolio over multiple deployments

Parameters:

Name Type Description Default
equity_curve Any

Equity curve series

required
orders List[Order]

Orders

required
algorithm_configuration AlgorithmConfiguration

Optional parameter to override default algorithm configuration

None
live_series bool

Equity curve series originates from LiveResult

False

Returns:

Type Description
Iterable[PointInTimePortfolio]

Enumerable of PointInTimePortfolio.

get_history

get_history(
    symbols: List[Symbol],
    start: Union[datetime, date],
    end: Union[datetime, date],
    resolution: Resolution,
) -> Iterable[Slice]

Gets the history for the given symbols from the start to the end

Parameters:

Name Type Description Default
symbols List[Symbol]

Symbols to request history for

required
start Union[datetime, date]

Start date of history request

required
end Union[datetime, date]

End date of history request

required
resolution Resolution

Resolution of history request

required

Returns:

Type Description
Iterable[Slice]

Enumerable of slices.