Skip to content

Metrics

QuantConnect.Report.Metrics

Bases: Object

Strategy metrics collection such as usage of funds and asset allocations

asset_allocations

asset_allocations(
    equity_curve: Any, orders: List[Order]
) -> Any
asset_allocations(
    portfolios: List[PointInTimePortfolio],
) -> Any

Signature descriptions:

  • Calculates the portfolio's asset allocation percentage over time. The series used to call this extension function should be the equity curve with the associated Order objects that go along with it.

  • Calculates the asset allocation percentage over time.

Parameters:

Name Type Description Default
equity_curve Optional[Any]

Equity curve series

None
orders Optional[List[Order]]

Orders associated with the equity curve

None
portfolios Optional[List[PointInTimePortfolio]]

Point in time portfolios

None

Returns:

Type Description
Any

Series keyed by Symbol containing the percentage allocated to that asset over time.

exposure

exposure(
    equity_curve: Any,
    orders: List[Order],
    direction: OrderDirection,
) -> Any
exposure(
    portfolios: List[PointInTimePortfolio],
    direction: OrderDirection,
) -> Any

Strategy long/short exposure by asset class

Parameters:

Name Type Description Default
equity_curve Optional[Any]

Equity curve

None
orders Optional[List[Order]]

Orders of the strategy

None
direction OrderDirection

Long or short

required
portfolios Optional[List[PointInTimePortfolio]]

Point in time portfolios

None

Returns:

Type Description
Any

Frame keyed by SecurityType and OrderDirection.

leverage_utilization

leverage_utilization(
    equity_curve: Any, orders: List[Order]
) -> Any
leverage_utilization(
    portfolios: List[PointInTimePortfolio],
) -> Any

Signature descriptions:

  • Calculates the leverage used from trades. The series used to call this extension function should be the equity curve with the associated Order objects that go along with it.

  • Gets the leverage utilization from a list of PointInTimePortfolio

Parameters:

Name Type Description Default
equity_curve Optional[Any]

Equity curve series

None
orders Optional[List[Order]]

Orders associated with the equity curve

None
portfolios Optional[List[PointInTimePortfolio]]

Point in time portfolios

None

Returns:

Type Description
Any

Depends on the signature used. Case 1: [Leverage utilization over time.]; Case 2: [Series of leverage utilization.]