UniverseDefinitions
QuantConnect.Algorithm.UniverseDefinitions
UniverseDefinitions(algorithm: QCAlgorithm)
Bases: Object
Provides helpers for defining universes in algorithms
Initializes a new instance of the UniverseDefinitions class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm
|
QCAlgorithm
|
The algorithm instance, used for obtaining the default UniverseSettings |
required |
dollar_volume
dollar_volume: DollarVolumeUniverseDefinitions
Gets a helper that provides methods for creating universes based on daily dollar volumes
unchanged
unchanged: UnchangedUniverse
Specifies that universe selection should not make changes on this iteration
qc_500
qc_500: Universe
Creates a new fine universe that contains the constituents of QC500 index based onthe company fundamentals The algorithm creates a default tradable and liquid universe containing 500 US equities which are chosen at the first trading day of each month.
etf
etf(
etf_ticker: str,
market: str = None,
universe_settings: UniverseSettings = None,
universe_filter_func: Any = None,
) -> Universe
etf(
etf_ticker: str,
universe_settings: UniverseSettings,
universe_filter_func: Any,
) -> Universe
etf(
symbol: Union[Symbol, str, BaseContract],
universe_settings: UniverseSettings = None,
universe_filter_func: Any = None,
) -> Universe
etf(
etf_ticker: str,
market: str,
universe_settings: UniverseSettings,
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
etf(
etf_ticker: str,
market: str,
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
etf(
etf_ticker: str,
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
etf(
etf_ticker: str,
universe_settings: UniverseSettings,
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
etf(
symbol: Union[Symbol, str, BaseContract],
universe_settings: UniverseSettings,
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
etf(
symbol: Union[Symbol, str, BaseContract],
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
Signature descriptions:
-
Creates a universe for the constituents of the provided etf_ticker
-
Creates a universe for the constituents of the provided ETF symbol
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
etf_ticker
|
Optional[str]
|
Ticker of the ETF to get constituents for |
None
|
market
|
Optional[str]
|
Market of the ETF |
None
|
universe_settings
|
Optional[UniverseSettings]
|
Universe settings |
None
|
universe_filter_func
|
Any | Callable[[List[ETFConstituentUniverse]], List[Symbol]]
|
Function to filter universe results |
None
|
symbol
|
Optional[Union[Symbol, str, BaseContract]]
|
ETF Symbol to get constituents for |
None
|
Returns:
| Type | Description |
|---|---|
Universe
|
New ETF constituents Universe. |
index
index(
index_ticker: str,
market: str = None,
universe_settings: UniverseSettings = None,
universe_filter_func: Any = None,
) -> Universe
index(
index_ticker: str,
universe_settings: UniverseSettings,
universe_filter_func: Any,
) -> Universe
index(
index_symbol: Union[Symbol, str, BaseContract],
universe_settings: UniverseSettings = None,
universe_filter_func: Any = None,
) -> Universe
index(
index_ticker: str,
market: str,
universe_settings: UniverseSettings,
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
index(
index_ticker: str,
market: str,
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
index(
index_ticker: str,
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
index(
index_ticker: str,
universe_settings: UniverseSettings,
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
index(
index_symbol: Union[Symbol, str, BaseContract],
universe_settings: UniverseSettings,
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
index(
index_symbol: Union[Symbol, str, BaseContract],
universe_filter_func: Callable[
[List[ETFConstituentUniverse]], List[Symbol]
],
) -> Universe
Signature descriptions:
-
Creates a universe for the constituents of the provided index_ticker
-
Creates a universe for the constituents of the provided index_symbol
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index_ticker
|
Optional[str]
|
Ticker of the index to get constituents for |
None
|
market
|
Optional[str]
|
Market of the index |
None
|
universe_settings
|
Optional[UniverseSettings]
|
Universe settings |
None
|
universe_filter_func
|
Any | Callable[[List[ETFConstituentUniverse]], List[Symbol]]
|
Function to filter universe results |
None
|
index_symbol
|
Optional[Union[Symbol, str, BaseContract]]
|
Index Symbol to get constituents for |
None
|
Returns:
| Type | Description |
|---|---|
Universe
|
New index constituents Universe. |
top
top(
count: int, universe_settings: UniverseSettings = None
) -> Universe
Creates a new coarse universe that contains the top count of stocks by daily dollar volume
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
The number of stock to select |
required |
universe_settings
|
UniverseSettings
|
The settings for stocks added by this universe. Defaults to QCAlgorithm.universe_settings |
None
|
Returns:
| Type | Description |
|---|---|
Universe
|
A new coarse universe for the top count of stocks by dollar volume. |