Skip to content

ISecurityProvider

QuantConnect.Securities.ISecurityProvider

Represents a type capable of fetching the holdings for the specified symbol

get_holdings_quantity

get_holdings_quantity(
    symbol: Union[Symbol, str, BaseContract, Security],
) -> float

Extension method to return the quantity of holdings, if no holdings are present, then zero is returned.

Parameters:

Name Type Description Default
symbol Union[Symbol, str, BaseContract, Security]

The symbol we want holdings quantity for

required

Returns:

Type Description
float

The quantity of holdings for the specified symbol.

get_security

get_security(
    symbol: Union[Symbol, str, BaseContract, Security],
) -> Security

Retrieves a summary of the holdings for the specified symbol

Parameters:

Name Type Description Default
symbol Union[Symbol, str, BaseContract, Security]

The symbol to get holdings for

required

Returns:

Type Description
Security

The holdings for the symbol or null if the symbol is invalid and/or not in the portfolio.