blpapi.TopicList

class blpapi.TopicList

A list of topics which require creation.

Contains a list of topics which require creation.

Created from topic strings or from TOPIC_SUBSCRIBED or RESOLUTION_SUCCESS messages. This is passed to a createTopics() call or createTopicsAsync() call on a ProviderSession. It is updated and returned by the createTopics() call.

CREATED = 1
FAILURE = 2
NOT_CREATED = 0
__init__(original=None)

Create an empty TopicList, or a TopicList based on original.

Parameters

original (TopicList) – Original topiclist to copy off of

If original is None - create empty TopicList. Otherwise create a TopicList from original.

add(topicOrMessage, correlationId=None)

Add the specified topic or topic from message to this TopicList.

Parameters
  • topicOrMessage (str or Message) – Topic string or message to create a topic from

  • correlationId (CorrelationId) – CorrelationId to associate with the topic

Returns

0 on success or negative number on failure.

Return type

int

Raises

TypeError – If correlationId is not an instance of CorrelationId.

If topic is passed as topicOrMessage, add the topic to this list, optionally specifying a correlationId. After a successful call to add() the status for this entry is NOT_CREATED.

If Message is passed as topicOrMessage, add the topic contained in the specified topicSubscribedMessage or resolutionSuccessMessage to this list, optionally specifying a correlationId. After a successful call to add() the status for this entry is NOT_CREATED.

correlationIdAt(index)
Parameters

index (int) – Index of the entry in the list

Returns

Correlation id of the indexth entry.

Return type

CorrelationId

Raises

Exception – If index >= size().

destroy()

Destroy this TopicList.

message(correlationId)
Parameters

correlationId (CorrelationId) – Correlation id associated with the message

Returns

Message received during creation of the topic identified by the specified correlationId.

Return type

Message

Raises

Exception – If correlationId does not identify an entry in this TopicList or if the status of the entry identified by correlationId is not CREATED.

The message returned can be used when creating an instance of Topic.

messageAt(index)
Parameters

index (int) – Index of the entry

Returns

Message received during creation of the entry at

index.

Return type

Message

Raises

Exception – If index >= size() or if the status of the entry identify by correlationId is not CREATED.

The message returned can be used when creating an instance of Topic.

size()

Return the number of entries in this TopicList.

status(correlationId)
Parameters

correlationId (CorrelationId) – Correlation id associated with the entry

Returns

Status of the entry in this list identified by the specified correlationId. This may be NOT_CREATED, CREATED and FAILURE.

Return type

int

Raises

Exception – If the correlationId does not identify an entry in this list.

statusAt(index)
Parameters

index (int) – Index of the entry

Returns

Status of the indexth entry in this list. This may be NOT_CREATED, CREATED and FAILURE.

Return type

int

Raises

Exception – If index >= size().

topicString(correlationId)
Parameters

correlationId (CorrelationId) – Correlation id associated with the topic.

Returns

Topic of the entry identified by ‘correlationId’.

Return type

str

Raises

Exception – If the correlationId does not identify an entry in this list.

topicStringAt(index)
Parameters

index (int) – Index of the entry

Returns

The full topic string of the indexth entry in this list.

Return type

str

Raises

Exception – If index >= size().