blpapi.TopicList

class blpapi.TopicList(original=None)

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 ResolutionList.

Parameters:

original – Original resolution list to use.

Raises:

TypeError – If original is not an instance of ResolutionList.

If original is None - create empty TopicList. Otherwise create a TopicList from original. In this case original is used by handle, so if the caller modifies original resolution list after the call, TopicList also changes because owns the same handle.

add(topicOrMessage, correlationId=None)

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

Parameters:
Return type:

int

Returns:

0 on success or negative number on failure.

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

Return type:

CorrelationId

Returns:

Correlation id of the indexth entry.

Raises:

Exception – If index >= size().

destroy()

Destroy the handle using stored dtor

Return type:

None

isValid()

Returns: True if this class holds a handle and the handle is not None.

Return type:

bool

message(correlationId)
Parameters:

correlationId (CorrelationId) – Correlation id associated with the message

Return type:

Message

Returns:

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

Raises:

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

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

messageAt(index)
Parameters:

index (int) – Index of the entry

Return type:

Message

Returns:

Message received during creation of the entry at

index.

Raises:

Exception – If index >= size().

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

size()

Return the number of entries in this TopicList.

Return type:

int

status(correlationId)
Parameters:

correlationId (CorrelationId) – Correlation id associated with the entry

Return type:

int

Returns:

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

Raises:

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

statusAt(index)
Parameters:

index (int) – Index of the entry

Return type:

int

Returns:

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

Raises:

Exception – If index >= size().

topicString(correlationId)
Parameters:

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

Return type:

str

Returns:

Topic of the entry identified by ‘correlationId’.

Raises:

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

topicStringAt(index)
Parameters:

index (int) – Index of the entry

Return type:

str

Returns:

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

Raises:

Exception – If index >= size().