blpapi.SubscriptionList
- class blpapi.SubscriptionList
A list of subscriptions.
Contains a list of subscriptions used when subscribing and unsubscribing.
A
SubscriptionList
is 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
topic
to thisSubscriptionList
.- Parameters:
Add the specified
topic
, with the optionally specifiedfields
and theoptions
to thisSubscriptionList
, associating the optionally specifiedcorrelationId
with it. Thefields
must be represented as a comma separated string or a list of strings,options
- as an ampersand separated string or list of strings or aname -> value
dictionary.- Return type:
Note
In case of unsubscribe, you can pass empty string or
None
fortopic
.
- addResolved(subscriptionString, correlationId=None)
- Parameters:
subscriptionString (
str
) – Fully-resolved subscription stringcorrelationId (
Optional
[CorrelationId
]) – Correlation id to associate with the subscription
Add the specified
subscriptionString
to thisSubscriptionList
object, associating the specifiedcorrelationId
with it. The subscription string may include options. The behavior of this function, and of functions operating on thisSubscriptionList
object, is undefined unlesssubscriptionString
is 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
SubscriptionList
whether to perform resolution on this subscription.
- append(other)
Append a copy of the specified
SubscriptionList
to 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:
True
if theindex``th entry in this ``SubscriptionList
object was created usingaddResolved()
andFalse
if it was created usingadd()
. An exception is thrown ifindex >= size()
.