QC500UniverseSelectionModel
QuantConnect.Algorithm.Framework.Selection.QC500UniverseSelectionModel
QC500UniverseSelectionModel()
QC500UniverseSelectionModel(
universe_settings: UniverseSettings,
)
Bases: FundamentalUniverseSelectionModel
Defines the QC500 universe as a universe selection model for framework algorithm For details: https://github.com/QuantConnect/Lean/pull/1663
Signature descriptions:
-
Initializes a new default instance of the QC500UniverseSelectionModel
-
Initializes a new instance of the QC500UniverseSelectionModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
universe_settings
|
Optional[UniverseSettings]
|
Universe settings defines what subscription properties will be applied to selected securities |
None
|
instance
instance: Any
Gets the underlying python instance
This codeEntityType is protected.
PythonRuntimeChecker
Bases: Object
Set of helper methods to invoke Python methods with runtime checks for return values and out parameter's conversions.
select_coarse
select_coarse(
algorithm: QCAlgorithm, coarse: List[CoarseFundamental]
) -> Iterable[Symbol]
Performs coarse selection for the QC500 constituents. The stocks must have fundamental data The stock must have positive previous-day close price The stock must have positive volume on the previous trading day
select_fine
select_fine(
algorithm: QCAlgorithm, fine: List[FineFundamental]
) -> Iterable[Symbol]
Performs fine selection for the QC500 constituents The company's headquarter must in the U.S. The stock must be traded on either the NYSE or NASDAQ At least half a year since its initial public offering The stock's market cap must be greater than 500 million
create_universes
create_universes(
algorithm: QCAlgorithm,
) -> Iterable[Universe]
Creates a new fundamental universe using this class's selection functions
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm
|
QCAlgorithm
|
The algorithm instance to create universes for |
required |
Returns:
| Type | Description |
|---|---|
Iterable[Universe]
|
The universe defined by this model. |
get_next_refresh_time_utc
get_next_refresh_time_utc() -> datetime
Gets the next time the framework should invoke the CreateUniverses method to refresh the set of universes.
equals
equals(obj: Any) -> bool
equals(
other: BasePythonWrapper[
QuantConnect_Python_BasePythonWrapper_TInterface
],
) -> bool
Signature descriptions:
-
Determines whether the specified object is an instance of BasePythonWrapper{TInterface} and wraps the same Python object reference as this instance, which would indicate that they are equal.
-
Determines whether the specified instance wraps the same Python object reference as this instance, which would indicate that they are equal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Optional[Any]
|
The other object to compare this with |
None
|
other
|
Optional[BasePythonWrapper[QuantConnect_Python_BasePythonWrapper_TInterface]]
|
The other object to compare this with |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if both instances are equal, that is if both wrap the same Python object reference. |
set_python_instance
set_python_instance(instance: Any) -> None
set_python_instance(
instance: Any, validate_interface: bool
) -> None
Signature descriptions:
-
Sets the python instance
-
Sets the python instance and sets the validate interface flag
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance
|
Any
|
The underlying python instance |
required |
validate_interface
|
Optional[bool]
|
Whether to perform validations for interface implementation |
None
|
dispose
dispose() -> None
Dispose of this instance
get_event
get_event(name: str) -> Any
Gets the Python instance event with the specified name
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the event |
required |
get_hash_code
get_hash_code() -> int
Gets the hash code for the current instance
Returns:
| Type | Description |
|---|---|
int
|
The hash code of the current instance. |
get_method
get_method(
method_name: str, python_only: bool = False
) -> Any
Gets the Python instances method with the specified name and caches it
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method_name
|
str
|
The name of the method |
required |
python_only
|
bool
|
Whether to only return python methods |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
The matched method. |
get_property
get_property(property_name: str) -> Any
Gets the Python instance property with the specified name
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
property_name
|
str
|
The name of the property |
required |
has_attr
has_attr(name: str) -> bool
Determines whether the Python instance has the specified attribute
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The attribute name |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether the Python instance has the specified attribute. |
invoke_method
invoke_method(
method_name: str, *args: Union[Object, Iterable[Object]]
) -> Any
Invokes the specified method with the specified arguments
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method_name
|
str
|
The name of the method |
required |
args
|
Union[Object, Iterable[Object]]
|
The arguments to call the method with |
()
|
invoke_void_method
invoke_void_method(
method_name: str, *args: Union[Object, Iterable[Object]]
) -> None
Invokes the specified method with the specified arguments without returning a value
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method_name
|
str
|
The name of the method |
required |
args
|
Union[Object, Iterable[Object]]
|
The arguments to call the method with |
()
|
set_property
set_property(property_name: str, value: Any) -> None
Sets the Python instance property with the specified name
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
property_name
|
str
|
The name of the property |
required |
value
|
Any
|
The property value |
required |
coarse
coarse(
coarse_selector: Callable[
[List[CoarseFundamental]], List[Symbol]
],
) -> IUniverseSelectionModel
Convenience method for creating a selection model that uses only coarse data
Fine and Coarse selection are merged, please use 'Fundamental(Func
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coarse_selector
|
Callable[[List[CoarseFundamental]], List[Symbol]]
|
Selects symbols from the provided coarse data set |
required |
Returns:
| Type | Description |
|---|---|
IUniverseSelectionModel
|
A new universe selection model that will select US equities according to the selection function specified. |
create_coarse_fundamental_universe
create_coarse_fundamental_universe(
algorithm: QCAlgorithm,
) -> Universe
Creates the coarse fundamental universe object. This is provided to allow more flexibility when creating coarse universe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm
|
QCAlgorithm
|
The algorithm instance |
required |
Returns:
| Type | Description |
|---|---|
Universe
|
The coarse fundamental universe. |
fine
fine(
coarse_selector: Callable[
[List[CoarseFundamental]], List[Symbol]
],
fine_selector: Callable[
[List[FineFundamental]], List[Symbol]
],
) -> IUniverseSelectionModel
Convenience method for creating a selection model that uses coarse and fine data
Fine and Coarse selection are merged, please use 'Fundamental(Func
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coarse_selector
|
Callable[[List[CoarseFundamental]], List[Symbol]]
|
Selects symbols from the provided coarse data set |
required |
fine_selector
|
Callable[[List[FineFundamental]], List[Symbol]]
|
Selects symbols from the provided fine data set (this set has already been filtered according to the coarse selection) |
required |
Returns:
| Type | Description |
|---|---|
IUniverseSelectionModel
|
A new universe selection model that will select US equities according to the selection functions specified. |
fundamental
fundamental(
selector: Callable[[List[Fundamental]], List[Symbol]],
) -> IUniverseSelectionModel
Convenience method for creating a selection model that uses fundamental data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selector
|
Callable[[List[Fundamental]], List[Symbol]]
|
Selects symbols from the provided fundamental data set |
required |
Returns:
| Type | Description |
|---|---|
IUniverseSelectionModel
|
A new universe selection model that will select US equities according to the selection functions specified. |
select
select(
algorithm: QCAlgorithm, fundamental: List[Fundamental]
) -> Iterable[Symbol]
Defines the fundamental selection function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm
|
QCAlgorithm
|
The algorithm instance |
required |
fundamental
|
List[Fundamental]
|
The fundamental data used to perform filtering |
required |
Returns:
| Type | Description |
|---|---|
Iterable[Symbol]
|
An enumerable of symbols passing the filter. |