Subscription
QuantConnect.Lean.Engine.DataFeeds.Subscription
Subscription(
subscription_request: SubscriptionRequest,
enumerator: IEnumerator[SubscriptionData],
time_zone_offset_provider: TimeZoneOffsetProvider,
)
Bases: Object, IEnumerator[SubscriptionData]
Represents the data required for a data feed to process a single subscription
Initializes a new instance of the Subscription class with a universe
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subscription_request
|
SubscriptionRequest
|
Specified for universe subscriptions |
required |
enumerator
|
IEnumerator[SubscriptionData]
|
The subscription's data source |
required |
time_zone_offset_provider
|
TimeZoneOffsetProvider
|
The offset provider used to convert data local times to utc |
required |
new_data_available
new_data_available: _EventContainer[
Callable[[Object, EventArgs], Any], Any
]
Event fired when a new data point is available
time_zone
time_zone: Any
Gets the exchange time zone associated with this subscription
offset_provider
offset_provider: TimeZoneOffsetProvider
Gets the offset provider for time zone conversions to and from the data's local time
realtime_price
realtime_price: float
Gets the most current value from the subscription source
end_of_stream
end_of_stream: bool
Gets true if this subscription is finished, false otherwise
is_universe_selection_subscription
is_universe_selection_subscription: bool
Gets true if this subscription is used in universe selection
utc_start_time
utc_start_time: datetime
Gets the start time of this subscription in UTC
utc_end_time
utc_end_time: datetime
Gets the end time of this subscription in UTC
removed_from_universe
removed_from_universe: IReadOnlyRef[bool]
Gets whether or not this subscription has been removed from its parent universe
current
current: SubscriptionData
Gets the element in the collection at the current position of the enumerator.
add_subscription_request
add_subscription_request(
subscription_request: SubscriptionRequest,
) -> bool
Adds a SubscriptionRequest for this subscription
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subscription_request
|
SubscriptionRequest
|
The SubscriptionRequest to add |
required |
dispose
dispose() -> None
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
equals
equals(obj: Any) -> bool
Determines whether the specified object is equal to the current object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Any
|
The object to compare with the current object. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
true if the specified object is equal to the current object; otherwise, false. |
get_hash_code
get_hash_code() -> int
Serves as a hash function for a particular type.
Returns:
| Type | Description |
|---|---|
int
|
A hash code for the current System.Object. |
mark_as_removed_from_universe
mark_as_removed_from_universe() -> None
Mark this subscription as having been removed from the universe. Data for this time step will be discarded.
move_next
move_next() -> bool
Advances the enumerator to the next element of the collection.
Returns:
| Type | Description |
|---|---|
bool
|
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. |
on_new_data_available
on_new_data_available() -> None
Event invocator for the new_data_available event
remove_subscription_request
remove_subscription_request(
universe: Universe = None,
) -> bool
Removes one or all SubscriptionRequest from this subscription
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
universe
|
Universe
|
Universe requesting to remove SubscriptionRequest. Default value, null, will remove all universes |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True, if the subscription is empty and ready to be removed. |
reset
reset() -> None
Sets the enumerator to its initial position, which is before the first element in the collection.
to_string
to_string() -> str
Returns a string that represents the current object.
Returns:
| Type | Description |
|---|---|
str
|
A string that represents the current object. |