blpapi.SubscriptionList
- class blpapi.SubscriptionList
A list of subscriptions.
Contains a list of subscriptions used when subscribing and unsubscribing.
A
SubscriptionListis used when callingSession.subscribe(),Session.resubscribe()andSession.unsubscribe(). The entries can be constructed in a variety of ways.The two important elements when creating a subscription are:
Subscription string: A subscription string represents a topic whose updates user is interested in.
CorrelationId: the unique identifier to tag all data associated with this subscription.
The following table describes how various operations use the above elements:
OPERATION
SUBSCRIPTION STRING
CORRELATION ID
subscribe
Used to specify thetopic to subscribe to.Identifier for thesubscription. Ifuninitializedcorrelationid wasspecified an internallygenerated correlationIdwill be set for thesubscription.resubscribe
Used to specify the newtopic to which thesubscription should bemodified to.Identifier of thesubscription whichneeds to be modified.unsubscribe
NOT USED
Identifier of thesubscription whichneeds to be canceled.- __init__()
Create an empty
SubscriptionList.
- add(topic, fields=None, options=None, correlationId=None)
Add the specified
topicto thisSubscriptionList.- Parameters:
Add the specified
topic, with the optionally specifiedfieldsand theoptionsto thisSubscriptionList, associating the optionally specifiedcorrelationIdwith it. Thefieldsmust be represented as a comma separated string or a list of strings,options- as an ampersand separated string or list of strings or aname -> valuedictionary.- Return type:
Note
In case of unsubscribe, you can pass empty string or
Nonefortopic.
- addResolved(subscriptionString, correlationId=None)
- Parameters:
subscriptionString (
str) – Fully-resolved subscription stringcorrelationId (
Optional[CorrelationId]) – Correlation id to associate with the subscription
Add the specified
subscriptionStringto thisSubscriptionListobject, associating the specifiedcorrelationIdwith it. The subscription string may include options. The behavior of this function, and of functions operating on thisSubscriptionListobject, is undefined unlesssubscriptionStringis a fully-resolved subscription string; clients that cannot provide fully-resolved subscription strings should useadd()instead.- Return type:
Note
It is at the discretion of each function operating on a
SubscriptionListwhether to perform resolution on this subscription.
- append(other)
Append a copy of the specified
SubscriptionListto this list.- Parameters:
other – List to append to this one
- correlationIdAt(index)
- isResolvedTopicAt(index)
- Parameters:
index (
int) – Index of the entry in the list- Return type:
- Returns:
Trueif theindex``th entry in this ``SubscriptionListobject was created usingaddResolved()andFalseif it was created usingadd(). An exception is thrown ifindex >= size().