DataManager
QuantConnect.Lean.Engine.DataFeeds.DataManager
DataManager(
data_feed: IDataFeed,
universe_selection: UniverseSelection,
algorithm: IAlgorithm,
time_keeper: ITimeKeeper,
market_hours_database: MarketHoursDatabase,
live_mode: bool,
registered_types_provider: IRegisteredSecurityDataTypesProvider,
data_permission_manager: IDataPermissionManager,
)
Bases: Object, IAlgorithmSubscriptionManager, IDataFeedSubscriptionManager, IDataManager
DataManager will manage the subscriptions for both the DataFeeds and the SubscriptionManager
Creates a new instance of the DataManager
subscription_added
subscription_added: _EventContainer[
Callable[[Object, Subscription], Any], Any
]
Event fired when a new subscription is added
subscription_removed
subscription_removed: _EventContainer[
Callable[[Object, Subscription], Any], Any
]
Event fired when an existing subscription is removed
data_feed_subscriptions
data_feed_subscriptions: SubscriptionCollection
Gets the data feed subscription collection
subscription_manager_subscriptions
subscription_manager_subscriptions: Iterable[
SubscriptionDataConfig
]
Gets all the current data config subscriptions that are being processed for the SubscriptionManager
available_data_types
available_data_types: Dictionary[
SecurityType, List[TickType]
]
The different TickType each SecurityType supports
add
add(
data_type: Type,
symbol: Union[Symbol, str, BaseContract],
resolution: Optional[Resolution] = None,
fill_forward: bool = True,
extended_market_hours: bool = False,
is_filtered_subscription: bool = True,
is_internal_feed: bool = False,
is_custom_data: bool = False,
data_normalization_mode: DataNormalizationMode = ...,
data_mapping_mode: DataMappingMode = ...,
contract_depth_offset: int = 0,
) -> SubscriptionDataConfig
add(
symbol: Union[Symbol, str, BaseContract],
resolution: Optional[Resolution] = None,
fill_forward: bool = True,
extended_market_hours: bool = False,
is_filtered_subscription: bool = True,
is_internal_feed: bool = False,
is_custom_data: bool = False,
subscription_data_types: List[
Tuple[Type, TickType]
] = None,
data_normalization_mode: DataNormalizationMode = ...,
data_mapping_mode: DataMappingMode = ...,
contract_depth_offset: int = 0,
) -> List[SubscriptionDataConfig]
Signature descriptions:
-
Creates and adds a list of SubscriptionDataConfig for a given symbol and configuration. Can optionally pass in desired subscription data type to use. If the config already existed will return existing instance instead
-
Creates and adds a list of SubscriptionDataConfig for a given symbol and configuration. Can optionally pass in desired subscription data types to use. If the config already existed will return existing instance instead
add_subscription
add_subscription(request: SubscriptionRequest) -> bool
Adds a new Subscription to provide data for the specified security.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
SubscriptionRequest
|
Defines the SubscriptionRequest to be added |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the subscription was created and added successfully, false otherwise. |
get_subscription_data_configs
get_subscription_data_configs(
symbol: Union[Symbol, str, BaseContract] = None,
include_internal_configs: bool = False,
) -> List[SubscriptionDataConfig]
Gets a list of all registered SubscriptionDataConfig for a given Symbol
lookup_subscription_config_data_types
lookup_subscription_config_data_types(
symbol_security_type: SecurityType,
resolution: Resolution,
is_canonical: bool,
) -> List[Tuple[Type, TickType]]
Get the data feed types for a given SecurityTypeResolution
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol_security_type
|
SecurityType
|
The SecurityType used to determine the types |
required |
resolution
|
Resolution
|
The resolution of the data requested |
required |
is_canonical
|
bool
|
Indicates whether the security is Canonical (future and options) |
required |
Returns:
| Type | Description |
|---|---|
List[Tuple[Type, TickType]]
|
Types that should be added to the SubscriptionDataConfig. |
remove_all_subscriptions
remove_all_subscriptions() -> None
Will remove all current Subscription
remove_subscription
remove_subscription(
configuration: SubscriptionDataConfig,
universe: Universe = None,
) -> bool
Removes the Subscription, if it exists
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration
|
SubscriptionDataConfig
|
The SubscriptionDataConfig of the subscription to remove |
required |
universe
|
Universe
|
Universe requesting to remove Subscription. Default value, null, will remove all universes |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if the subscription was successfully removed, false otherwise. |
subscription_manager_count
subscription_manager_count() -> int
Returns the amount of data config subscriptions processed for the SubscriptionManager
subscription_manager_get_or_add
subscription_manager_get_or_add(
new_config: SubscriptionDataConfig,
) -> SubscriptionDataConfig
Gets existing or adds new SubscriptionDataConfig
Returns:
| Type | Description |
|---|---|
SubscriptionDataConfig
|
Returns the SubscriptionDataConfig instance used. |